.gitlab-ci.yml
variables:
DOCKER_HOST: tcp://docker:2375/
QUANTUM_CLI: registry.internal.planetary-networks.de/quantum-public/cli:2
QUANTUM_ENDPOINT: sva-services
stages:
- build
- tag
- predeploy
- deploy
services:
- docker:19.03.0-dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
.docker-build: &docker-build
stage: build
script:
- docker pull $IMAGE:latest || true
- docker build --cache-from $IMAGE:latest --tag $IMAGE:$CI_COMMIT_SHA --tag $IMAGE:latest -f $DOCKERFILE .
- docker push $IMAGE:$CI_COMMIT_SHA
- docker push $IMAGE:latest
.quantum-conf: &quantum-conf
stage: predeploy
image:
name: docker/compose:1.25.0
cache:
key: "${CI_PIPELINE_ID}-${PROJECT}"
paths: [quantum.yaml]
script:
- docker-compose -f docker-compose.yml -f stack.yml config > quantum.yaml
only:
- master
.deploy: &deploy
stage: deploy
image: $QUANTUM_CLI
cache:
key: "${CI_PIPELINE_ID}-${PROJECT}"
paths: [quantum.yaml]
script:
- quantum-cli stack update --create --stack $PROJECT-$QUANTUM_ENDPOINT --wait
tags: [v2]
only:
- master
build-app:
variables:
IMAGE: $CI_REGISTRY_IMAGE
DOCKERFILE: Dockerfile
<<: *docker-build
app-conf:
<<: *quantum-conf
variables:
PROJECT: bb-bad-belzig-tmb-importer
deploy:
<<: *deploy
variables:
PROJECT: bb-bad-belzig-tmb-importer