-
Notifications
You must be signed in to change notification settings - Fork 88
/
.travis.yml
30 lines (25 loc) · 1.02 KB
/
.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
sudo: required
language: c
services:
- docker
script:
# Lint
- docker run -it --rm -v "$PWD/Dockerfile:/Dockerfile:ro" redcoolbeans/dockerlint
- docker run -it --rm -v "$PWD/Dockerfile.onbuild:/Dockerfile:ro" redcoolbeans/dockerlint
env:
global:
- COMMIT=${TRAVIS_COMMIT::8}
after_success:
# Setup
- export REPO=gatsbyjs/gatsby
- export MAIN_TAG=`if [ "$TRAVIS_BRANCH" = "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- export ONBUILD_TAG=`if [ "$TRAVIS_BRANCH" = "master" ]; then echo "onbuild"; else echo "$MAIN_TAG-onbuild" ; fi`
- echo "Main tag - $MAIN_TAG | Onbuild - $ONBUILD_TAG | Commit (shorten) - $COMMIT | Branch - $TRAVIS_BRANCH"
-
- docker login -u $DOCKER_USER -p $DOCKER_PASS
# Build and deploy
- docker build -f Dockerfile -t $REPO:$COMMIT .
- cat Dockerfile.onbuild | sed "s#gatsbyjs/gatsby:latest#$REPO:$COMMIT#g" | docker build -t $REPO:$COMMIT-onbuild -
- docker tag $REPO:$COMMIT $REPO:$MAIN_TAG
- docker tag $REPO:$COMMIT-onbuild $REPO:$ONBUILD_TAG
- docker push $REPO