Skip to content

Commit

Permalink
Move build of setup image into docker-compose (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
c-w committed Mar 28, 2019
1 parent 28d51ac commit c523095
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
4 changes: 1 addition & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ to initialize the required cloud resources.
REGISTRATION_PASSWORD={some password for the registration endpoint}
EOM
docker build -t setup -f docker/setup/Dockerfile .
docker run \
docker-compose run \
-e SP_APPID={appId field of your service principal} \
-e SP_PASSWORD={password field of your service principal} \
-e SP_TENANT={tenant field of your service principal} \
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ services:
- azurite
- rabbitmq

setup:
image: ${DOCKER_REPO}/opwenserver_setup:${BUILD_TAG}
build:
context: .
dockerfile: docker/setup/Dockerfile
command: /app/setup.sh --help

rabbitmq:
image: rabbitmq:3.7.8-management

Expand Down
5 changes: 5 additions & 0 deletions docker/setup/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ scriptname="${BASH_SOURCE[0]}"
# shellcheck disable=SC1090
. "${scriptdir}/utils.sh"

if [[ "$1" = "--help" ]]; then
usage "${scriptname}"
exit 0
fi

#
# verify inputs
#
Expand Down
7 changes: 2 additions & 5 deletions travis/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ docker login --username="$DOCKER_USERNAME" --password="$DOCKER_PASSWORD"
for tag in "latest" "$TRAVIS_TAG"; do
BUILD_TAG="$tag" DOCKER_REPO="$DOCKER_USERNAME" docker-compose build
BUILD_TAG="$tag" DOCKER_REPO="$DOCKER_USERNAME" docker-compose push

docker build -t "$DOCKER_USERNAME/opwenserver_setup:$tag" -f "./docker/setup/Dockerfile" "."
docker push "$DOCKER_USERNAME/opwenserver_setup:$tag"
done

#
Expand All @@ -35,13 +32,13 @@ fi
kubeconfig_path="$PWD/kube-config"
curl -sfL "$KUBECONFIG_URL" -o "$kubeconfig_path"

docker run \
docker-compose run \
-e IMAGE_REGISTRY="$DOCKER_USERNAME" \
-e DOCKER_TAG="$TRAVIS_TAG" \
-e HELM_NAME="$HELM_NAME" \
-e LOKOLE_DNS_NAME="$LOKOLE_DNS_NAME" \
-v "$kubeconfig_path:/secrets/kube-config" \
"$DOCKER_USERNAME/opwenserver_setup:$TRAVIS_TAG" \
setup \
/app/upgrade.sh

rm "$kubeconfig_path"
Expand Down

0 comments on commit c523095

Please sign in to comment.