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

Commit

Permalink
[Docker] Setup deployment of demo docker image (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrerom authored Jul 13, 2016
1 parent 0174637 commit 967e6a1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ services:
env:
global:
- COMPOSE_FILE="doc/docker-compose/base-dev.yml:doc/docker-compose/selenium.yml"
- INSTALL_EZ_INSTALL_TYPE=demo
# list of behat arguments to test
matrix:
- ARGS="--profile=rest --suite=fullJson" COMPOSE_FILE="doc/docker-compose/base-prod.yml:doc/docker-compose/selenium.yml"
- 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"
- ARGS="--profile=rest --suite=fullXml" SYMFONY_ENV=behat SYMFONY_DEBUG=1
- ARGS="--profile=core" SYMFONY_ENV=behat SYMFONY_DEBUG=1

# test only master (+ Pull requests)
branches:
only:
- master
- "1.3"
- /^\d.\d$/
- /^v\d.\d.\d$/

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

# Push prod image to docker hub on sucess (on tags)
after_success: if [ "$REMOTE_IMAGE" != "" ] && [ "$TRAVIS_TAG" != "" ]; then bin/.ci/docker_hub_push.sh ${APP_PROD_IMAGE} ${REMOTE_IMAGE}; fi

# disable mail notifications
notifications:
email: false
Expand Down
49 changes: 49 additions & 0 deletions bin/.ci/docker_hub_push.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env sh

set -e

# See .travis.yml for example use

validateEnvironment()
{
if [ "$DOCKER_EMAIL" = "" ]; then
echo "Environment variable DOCKER_EMAIL is not set. Bailing out !"
exit 1
fi
if [ "$DOCKER_USERNAME" = "" ]; then
echo "Environment variable DOCKER_USERNAME is not set. Bailing out !"
exit 1
fi
if [ "$DOCKER_PASSWORD" = "" ]; then
echo "Environment variable DOCKER_PASSWORD is not set. Bailing out !"
exit 1
fi
}

validateEnvironment

if [ "$1" = "" ]; then
echo "Argument 1 variable APP_PROD_IMAGE is not set, format: ezplatform-demo. Bailing out !"
exit 1
fi


if [ "$2" = "" ]; then
echo "Argument 2 variable REMOTE_IMAGE is not set, format: ezsystems/ezplatform-demo. Bailing out !"
exit 1
fi

APP_PROD_IMAGE="$1"
REMOTE_IMAGE="$2"

# Debug
docker images

# Login
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"

## TAG
docker tag "${APP_PROD_IMAGE}" "${REMOTE_IMAGE}:latest"

echo "Pushing docker image with all tags : ${REMOTE_IMAGE}"
docker push "${REMOTE_IMAGE}"
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 967e6a1

Please sign in to comment.