-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy.sh
32 lines (28 loc) · 1.15 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# required Travis-ci secret variables (all other variables to be set in .travis.yml)
# DOCKER_PASS, DOCKER_USER
# login to docker
echo $DOCKER_PASS | docker login -u $DOCKER_USER --password-stdin &> /dev/null || exit 1
# push dev image (only latest)
if [ "$TRAVIS_BRANCH" = "develop" -a "$UBUNTU_VERSION" = "latest" ]; then
echo "build and push docker image(s) for version $IMAGE:dev"
docker build --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE:dev .
docker push $IMAGE:dev
fi
# push master images (not when it's a pull request)
if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
# tag including ALPINE version
if [ "$UBUNTU_VERSION" = "latest" ]; then
echo "build and push docker image(s) for version $IMAGE:latest"
docker build --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE:latest .
docker push $IMAGE:latest
else
# build and push with correct version tag
echo "build and push docker image(s) for version $IMAGE:$UBUNTU_VERSION"
docker build --build-arg UBUNTU_VERSION=$UBUNTU_VERSION \
-t $IMAGE:$UBUNTU_VERSION .
docker push $IMAGE:$UBUNTU_VERSION
fi
fi