Skip to content
This repository was archived by the owner on May 27, 2020. It is now read-only.

Commit 967e6a1

Browse files
authored
[Docker] Setup deployment of demo docker image (#28)
1 parent 0174637 commit 967e6a1

File tree

3 files changed

+61
-7
lines changed

3 files changed

+61
-7
lines changed

.travis.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ services:
88
env:
99
global:
1010
- COMPOSE_FILE="doc/docker-compose/base-dev.yml:doc/docker-compose/selenium.yml"
11+
- INSTALL_EZ_INSTALL_TYPE=demo
1112
# list of behat arguments to test
1213
matrix:
13-
- ARGS="--profile=rest --suite=fullJson" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/selenium.yml"
14+
- ARGS="--profile=rest --suite=fullJson" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/selenium.yml" REMOTE_IMAGE="ezsystems/ezplatform-demo" APP_PROD_IMAGE="ezplatform-demo"
1415
- ARGS="--profile=rest --suite=fullXml" SYMFONY_ENV=behat SYMFONY_DEBUG=1
1516
- ARGS="--profile=core" SYMFONY_ENV=behat SYMFONY_DEBUG=1
1617

1718
# test only master (+ Pull requests)
1819
branches:
1920
only:
2021
- master
21-
- "1.3"
22+
- /^\d.\d$/
23+
- /^v\d.\d.\d$/
2224

2325
# Update Docker and Docker Compose
2426
before_install: ./bin/.travis/trusty/update_docker.sh
@@ -37,6 +39,9 @@ before_script:
3739
# using behat.yml which is a copy of behat.yml.dist with hostnames update by docker-compose.behat.yml
3840
script: docker-compose exec --user www-data app sh -c "php /scripts/wait_for_db.php; php bin/behat -vv $ARGS --tags=~@broken"
3941

42+
# Push prod image to docker hub on sucess (on tags)
43+
after_success: if [ "$REMOTE_IMAGE" != "" ] && [ "$TRAVIS_TAG" != "" ]; then bin/.ci/docker_hub_push.sh ${APP_PROD_IMAGE} ${REMOTE_IMAGE}; fi
44+
4045
# disable mail notifications
4146
notifications:
4247
email: false

bin/.ci/docker_hub_push.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env sh
2+
3+
set -e
4+
5+
# See .travis.yml for example use
6+
7+
validateEnvironment()
8+
{
9+
if [ "$DOCKER_EMAIL" = "" ]; then
10+
echo "Environment variable DOCKER_EMAIL is not set. Bailing out !"
11+
exit 1
12+
fi
13+
if [ "$DOCKER_USERNAME" = "" ]; then
14+
echo "Environment variable DOCKER_USERNAME is not set. Bailing out !"
15+
exit 1
16+
fi
17+
if [ "$DOCKER_PASSWORD" = "" ]; then
18+
echo "Environment variable DOCKER_PASSWORD is not set. Bailing out !"
19+
exit 1
20+
fi
21+
}
22+
23+
validateEnvironment
24+
25+
if [ "$1" = "" ]; then
26+
echo "Argument 1 variable APP_PROD_IMAGE is not set, format: ezplatform-demo. Bailing out !"
27+
exit 1
28+
fi
29+
30+
31+
if [ "$2" = "" ]; then
32+
echo "Argument 2 variable REMOTE_IMAGE is not set, format: ezsystems/ezplatform-demo. Bailing out !"
33+
exit 1
34+
fi
35+
36+
APP_PROD_IMAGE="$1"
37+
REMOTE_IMAGE="$2"
38+
39+
# Debug
40+
docker images
41+
42+
# Login
43+
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
44+
45+
## TAG
46+
docker tag "${APP_PROD_IMAGE}" "${REMOTE_IMAGE}:latest"
47+
48+
echo "Pushing docker image with all tags : ${REMOTE_IMAGE}"
49+
docker push "${REMOTE_IMAGE}"

composer.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)