-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
72 lines (58 loc) · 1.71 KB
/
.travis.yml
File metadata and controls
72 lines (58 loc) · 1.71 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
dist: bionic
os:
- linux
services:
- docker
branches:
only:
- develop
- master
- stable
env:
global:
- COMMIT=${TRAVIS_COMMIT::7}
DOCKER_COMPOSE_VERSION: 3
language: php
php:
- '7.2'
- '7.3'
- '7.4'
matrix:
fast_finish: true
cache:
directories:
- "$HOME/.composer/cache"
before_install:
- docker build --pull --force-rm --no-cache -f ./docker/nginx/Dockerfile -t "$REPO"/"$APP_NAME"_nginx:"$TRAVIS_BRANCH"-"$COMMIT" ./docker/nginx
- docker build --pull --force-rm --no-cache -f ./Dockerfile -t "$REPO"/"$APP_NAME"_php:"$TRAVIS_BRANCH"-"$COMMIT" .
before_script:
- travis_retry composer update -n
- sudo rm .env
- echo "BRANCH=$TRAVIS_BRANCH" >> .env
- echo "COMMIT=$COMMIT" >> .env
- echo "APP_NAME=$APP_NAME" >> .env
- echo "APP_PATH=$APP_PATH" >> .env
- echo "REPO=$REPO" >> .env
- |
if [[ "$TRAVIS_BRANCH" == "master" ]]; then
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
else
docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d
fi
script:
# just a test script, literally.
# needs to be executable, eg. $ chmod +x test.sh (locally)
# or you can chmod it in the before_install section above
- sh ./test.sh
after_script:
- |
if [[ "$TRAVIS_BRANCH" == "master" ]]; then
docker-compose -f docker-compose.yml -f docker-compose.prod.yml down -v
else
docker-compose -f docker-compose.yml -f docker-compose.override.yml down -v
fi
after_success:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push "$REPO"/"$APP_NAME"_nginx:"$TRAVIS_BRANCH"-"$COMMIT";
- docker push "$REPO"/"$APP_NAME"_php:"$TRAVIS_BRANCH"-"$COMMIT";
sudo: required