-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
39 lines (31 loc) · 978 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
30
31
32
33
34
35
36
37
38
language: node_js
sudo: required
services:
- docker
node_js:
- 10
addons:
apt:
packages:
- sshpass
env:
- IMAGE_NAME=sosconf/frontend:latest
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/$IMAGE_NAME" "$IMAGE_NAME:$TRAVIS_TAG";
docker push "$IMAGE_NAME:$TRAVIS_TAG";
fi