feat(Docker-Compose) Add docker Compose Templates

This commit is contained in:
mfeix 2021-07-15 14:56:19 +02:00
parent a16ef0ae08
commit 524c42bca6
No known key found for this signature in database
GPG Key ID: 04D016E104A25F03
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,23 @@
.deploy-docker-compose:
image: docker/compose:alpine-1.29.1
stage: deploy
# variables:
# SCP_DESTINATION: "path to destination where scp is copying files"
# SCP_SOURCE: "path to local files"
# COMPOSE_EXTRA_ARGS: "Extra arguments that will be passed to docker-compose"
# SSH_URL: "url to the SSH service"
# SSH_USER: "username of the ssh connection"
rules:
- when: manual
# https://docs.gitlab.com/ee/ci/ssh_keys/
before_script:
- if [ -f "setup_env.sh" ]; then chmod +x ./setup_env.sh; ./setup_env.sh; fi
- 'command -v ssh-agent >/dev/null || ( apk --update add openssh-client )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan $SSH_URL >> ~/.ssh/known_hosts
script:
- if [[ -n "$SCP_SOURCE" && -n "$SCP_DESTINATION" ]]; then scp -rp $SCP_SOURCE $SSH_USER@$SSH_URL:$SCP_DESTINATION; fi
- DOCKER_HOST=ssh://$SSH_USER@$SSH_URL docker-compose $COMPOSE_EXTRA_ARGS up -d

View File

@ -0,0 +1,7 @@
Validate Intern:
image: docker/compose:alpine-1.29.1
stage: test
# variables:
# COMPOSE_EXTRA_ARGS:
script:
- docker-compose $COMPOSE_EXTRA_ARGS config