Commit ef05ae0e authored by Matija Obreza's avatar Matija Obreza
Browse files

Docker: Updated image versioning

parent 53457572
variables: variables:
VERSION: "3.0.0-alpha"
DOCKER_VERSION: latest DOCKER_VERSION: latest
DOCKER_HOST: "genesys1.swarm.genesys-pgr.org" DOCKER_HOST: "genesys1.swarm.genesys-pgr.org"
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log. # This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
...@@ -70,9 +71,17 @@ package amphibian branch: ...@@ -70,9 +71,17 @@ package amphibian branch:
- cd amphibian-server - cd amphibian-server
- cp target/*.war docker - cp target/*.war docker
- cd docker - cd docker
- ${DOCKER_CMD} build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG} . - if [ "${CI_COMMIT_REF_SLUG}" = "master" ] ; then
export IMAGE_TAG="${VERSION}";
export IMAGE_EXTRA="latest";
else
export IMAGE_TAG="${CI_COMMIT_REF_SLUG}";
fi
- "echo The image tag: ${IMAGE_TAG}"
- ${DOCKER_CMD} build -t ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} .
- ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY - ${DOCKER_CMD} login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- ${DOCKER_CMD} push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG} - ${DOCKER_CMD} push ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}
- if [ "${IMAGE_EXTRA}" != "" ]; then ${DOCKER_CMD} tag ${CI_REGISTRY_IMAGE}:${IMAGE_TAG} ${CI_REGISTRY_IMAGE}:${IMAGE_EXTRA}; ${DOCKER_CMD} push ${CI_REGISTRY_IMAGE}:${IMAGE_EXTRA}; fi
- ${DOCKER_CMD} logout $CI_REGISTRY - ${DOCKER_CMD} logout $CI_REGISTRY
dockerize amphibian: dockerize amphibian:
...@@ -117,7 +126,7 @@ deploy on staging server: ...@@ -117,7 +126,7 @@ deploy on staging server:
variables: variables:
GIT_STRATEGY: none GIT_STRATEGY: none
script: script:
- echo Deploying ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG} to staging server - echo Deploying ${CI_REGISTRY_IMAGE}:latest to staging server
# Address the swarm # Address the swarm
- export DOCKER_HOST=swarm.genesys-pgr.org - export DOCKER_HOST=swarm.genesys-pgr.org
# Configuration # Configuration
...@@ -129,7 +138,7 @@ deploy on staging server: ...@@ -129,7 +138,7 @@ deploy on staging server:
- export DOCKER_CERT_PATH=${TLS_PATH} - export DOCKER_CERT_PATH=${TLS_PATH}
- DOCKER_CMD=docker - DOCKER_CMD=docker
# Actions # Actions
- ${DOCKER_CMD} service update --image ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG} amphibian_sandbox - ${DOCKER_CMD} service update --image ${CI_REGISTRY_IMAGE}:latest amphibian_sandbox
deploy to production: deploy to production:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment