forked from fjudith/docker-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
123 lines (115 loc) · 5.49 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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
env:
global:
# Docker Repository
- REPO=fjudith/wordpress
# Compute docker tag
- TAG=`if [ "${TRAVIS_BRANCH}" == "master" ]; then echo "latest"; else echo ${TRAVIS_BRANCH}-fpm ; fi`
- PHP5=`if [ "${TRAVIS_BRANCH}" == "master" ]; then echo "php5-fpm"; else echo ${TRAVIS_BRANCH}-php5-fpm ; fi`
- PHP7=`if [ "${TRAVIS_BRANCH}" == "master" ]; then echo "php7-fpm"; else echo ${TRAVIS_BRANCH}-php7.1-fpm ; fi`
- NGINX=`if [ "${TRAVIS_BRANCH}" == "master" ]; then echo "nginx"; else echo ${TRAVIS_BRANCH}-nginx ; fi`
- CLI=`if [ "${TRAVIS_BRANCH}" == "master" ]; then echo "cli"; else echo ${TRAVIS_BRANCH}-cli ; fi`
# Retreive commit ID
- COMMIT=${TRAVIS_COMMIT::8}
- secure: "rLhPLS9ZvT0kovidLhouHGhoNK2jZKPP9h6om4QPlwtUuVRnMG1HOwZV6RnUkdTAZUkhvLeAk+3atHObtDaTi86yqBIPyi4cjoF8y5QV4BEJmZcpNs9ECWJRHpeYjJqY1lrGCnxBnSMR5ldI55FR+jtVo9PbARrDuIcwOf+irQ39nG+NRPqYfNjo4TG1QWQdqfF6HOIkOU9BTexy2blbOOEDpinh8U+v9tiqh6aToLP/t8B2aY9NP1Mn6MHQK2ALdk79RDjzgjNsm7A/h+Os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cPHys/8ohYgm3ST0Q7iS2YqPgB4="
sudo: required
services:
- docker
before_install:
# BUILD
#
# php5-fpm: build
- docker build -f php5-fpm/Dockerfile -t ${REPO}:${COMMIT}-php5-fpm php5-fpm/
# php7-fpm: build
- docker build -f php7-fpm/Dockerfile -t ${REPO}:${COMMIT}-php7-fpm php7-fpm/
# nginx: build
- docker build -f nginx/Dockerfile -t ${REPO}:${COMMIT}-nginx nginx/
# nginx: cli
- docker build -f cli/Dockerfile -t ${REPO}:${COMMIT}-cli cli/
# RUN
#
## php5: network
docker network create wordpress-php5
## php5: mariadb
- docker run -d --name "php5-md-${TRAVIS_BUILD_NUMBER}" \
--network wordpress-php5 \
-e MYSQL_DATABASE=wordpress \
-e MYSQL_ROOT_PASSWORD=Ch4ng3m3 \
-e MYSQL_USER=wordpress \
-e MYSQL_PASSWORD=Ch4ng3m3 \
mariadb
## php5: memcached
- docker run -d --name "php5-mc-${TRAVIS_BUILD_NUMBER}" memcached
## php5: fpm
- sleep 15
- docker run -d --name "php5-fpm-${TRAVIS_BUILD_NUMBER}"
--network wordpress-php5 \
-v php5-data:/var/www/html \
-e WORDPRESS_DB_HOST=mariadb \
-e WORDPRESS_DB_NAME=wordpress \
-e WORDPRESS_DB_USER=wordpress \
-e WORDPRESS_DB_PASSWORD=Ch4ng3m3 \
${REPO}:${COMMIT}-php5-fpm
## php5: nginx
- docker run -d --name "php5-nginx-${TRAVIS_BUILD_NUMBER}" \
--network wordpress-php5 \
-v php5-data:/var/www/html \
${REPO}:${COMMIT}-nginx
## php7: network
docker network create wordpress-php7
## php7: mariadb
- docker run -d --name "php7-md-${TRAVIS_BUILD_NUMBER}" \
--network wordpress-php7 \
-e MYSQL_DATABASE=wordpress \
-e MYSQL_ROOT_PASSWORD=Ch4ng3m3 \
-e MYSQL_USER=wordpress \
-e MYSQL_PASSWORD=Ch4ng3m3 \
mariadb
## php7: memcached
- docker run -d --name "php7-mc-${TRAVIS_BUILD_NUMBER}" memcached
## php7: fpm
- sleep 15
- docker run -d --name "php7-fpm-${TRAVIS_BUILD_NUMBER}" \
--network wordpress-php7 \
-v php7-data:/var/www/html \
-e WORDPRESS_DB_HOST=mariadb \
-e WORDPRESS_DB_NAME=wordpress \
-e WORDPRESS_DB_USER=wordpress \
-e WORDPRESS_DB_PASSWORD=Ch4ng3m3 \
${REPO}:${COMMIT}-php7-fpm
## php7: nginx
- docker run -d --name "php7-nginx-${TRAVIS_BUILD_NUMBER}" \
-v php7-data:/var/www/html \
${REPO}:${COMMIT}-nginx
## php7: cli
- docker run -d --name "php7-cli-${TRAVIS_BUILD_NUMBER}" \
-v php7-data:/var/www/html \
${REPO}:${COMMIT}-cli
script:
# wait 15 seconds for application initialization
# php5: test
- docker run --rm --network wordpress-php5 \
phusion/baseimage \
/bin/bash -c "curl -ik -L http://php5-nginx-${TRAVIS_BUILD_NUMBER}:80"
# php7: test
- docker run --rm --network wordpress-php7 \
phusion/baseimage \
/bin/bash -c "curl -ik -L http://php7-nginx-${TRAVIS_BUILD_NUMBER}:80"
after_success:
- docker login -u $DOCKER_USER -p $DOCKER_PASS
# latest
- docker tag ${REPO}:${COMMIT}-php5-fpm ${REPO}:${TAG}
# php5
- docker tag ${REPO}:${COMMIT}-php5-fpm ${REPO}:${PHP5}
- docker tag ${REPO}:${COMMIT}-php5-fpm ${REPO}:travis-${TRAVIS_BUILD_NUMBER}-php5-fpm
# php7
- docker tag ${REPO}:${COMMIT}-php7-fpm ${REPO}:${PHP7}
- docker tag ${REPO}:${COMMIT}-php7-fpm ${REPO}:travis-${TRAVIS_BUILD_NUMBER}-php7-fpm
# nginx
- docker tag ${REPO}:${COMMIT}-nginx ${REPO}:${NGINX}
- docker tag ${REPO}:${COMMIT}-nginx ${REPO}:travis-${TRAVIS_BUILD_NUMBER}-nginx
# cli
- docker tag ${REPO}:${COMMIT}-cli ${REPO}:${CLI}
- docker tag ${REPO}:${COMMIT}-cli ${REPO}:travis-${TRAVIS_BUILD_NUMBER}-cli
# push to public registry
- docker push ${REPO}