diff --git a/docker-compose-deploy.gitlab-ci.yml b/docker-compose-deploy.gitlab-ci.yml new file mode 100644 index 0000000..fb05d96 --- /dev/null +++ b/docker-compose-deploy.gitlab-ci.yml @@ -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 \ No newline at end of file diff --git a/docker-compose-validate.gitlab-ci.yml b/docker-compose-validate.gitlab-ci.yml new file mode 100644 index 0000000..301247a --- /dev/null +++ b/docker-compose-validate.gitlab-ci.yml @@ -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 \ No newline at end of file