forked from xordiv/docker-alpine-cron
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.travis.yml
29 lines (25 loc) · 913 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/cron
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" == "latest" && "$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