forked from instantbox/instantbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
29 lines (25 loc) · 919 Bytes
/
.travis.yml
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
language: minimal
sudo: required
services:
- docker
env:
- IMAGE_NAME=instantbox/instantbox
script:
- docker pull "$IMAGE_NAME" || true
- docker build --cache-from "$IMAGE_NAME"
--build-arg BUILD_DATE="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
--build-arg VCS_REF="$TRAVIS_COMMIT"
-t "build/$IMAGE_NAME" -f ./Dockerfile .
- docker run -d -P --name temp "build/$IMAGE_NAME"
- docker rm -f temp || true
after_success:
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD_SECURE";
docker tag "build/$IMAGE_NAME" "$IMAGE_NAME";
docker push "$IMAGE_NAME";
fi
- if [[ -n "$TRAVIS_TAG" ]]; then
docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD_SECURE";
docker tag "build/$IMAGENAME" "$IMAGENAME:$TRAVIS_TAG";
docker push "$IMAGE_NAME:$TRAVIS_TAG";
fi