Hello,
We have a CI pipeline running at our hosted GitLab Community Edition 11.6.1 that two stages running at different runner machines.
I need only the docker-compose.yml from repository at deploy stage but i don’t want to poll all source code at this stage.
So that i set GIT_STRATEGY to none. But this way docker-compose command fails because docker-compose.yml is not there.
I thought generating the docker-compose.yml file with echo or other shell utilities but i worry about correct indentation etc.
How can achive my goal in a clear way?
stages:
- BUILD
- DEPLOY
variables:
APP_IMAGE_TAG: $CI_REGISTRY_IMAGE/$CI_COMMIT_REF_NAME:$CI_COMMIT_SHA
BUILD:
stage: BUILD
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# build application image
- docker build -t $APP_IMAGE_TAG .
- docker push $APP_IMAGE_TAG
# Cleaun up
- docker rmi $APP_IMAGE_TAG
- 'docker rm $(docker ps -a -q) || :' # Delete all stopped containers
- 'docker rmi $(docker images -q --filter "dangling=true") || :' # Delete all untagged images
- docker image prune -f
tags:
- docker-image-build
DEPLOY:
stage: DEPLOY
variables:
GIT_STRATEGY: none
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker-compose down
- docker-compose up
tags:
- docker-runner