Update .gitlab-ci.yml
This commit is contained in:
parent
8c5b698acb
commit
c00916decf
1 changed files with 19 additions and 1 deletions
|
@ -1,11 +1,13 @@
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
|
- cleanup
|
||||||
|
- publish
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
LATEST_IMAGE: '$CI_REGISTRY_IMAGE:latest'
|
LATEST_IMAGE: '$CI_REGISTRY_IMAGE:latest'
|
||||||
PRODUCTION_URL: 'https://home.unjx.de'
|
PRODUCTION_URL: 'https://home.unjx.de'
|
||||||
|
|
||||||
image: docker:$V_DOCKER
|
image: docker:${V_DOCKER}-dind
|
||||||
|
|
||||||
.auth_gitlab:
|
.auth_gitlab:
|
||||||
before_script:
|
before_script:
|
||||||
|
@ -40,3 +42,19 @@ build:
|
||||||
--push
|
--push
|
||||||
after_script:
|
after_script:
|
||||||
- !reference [.auth_gitlab, after_script]
|
- !reference [.auth_gitlab, after_script]
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
rules: !reference [.rules:deploy, rules]
|
||||||
|
stage: cleanup
|
||||||
|
script:
|
||||||
|
- docker system prune -a -f
|
||||||
|
- docker volume prune -a -f
|
||||||
|
|
||||||
|
publish:
|
||||||
|
rules: !reference [.rules:deploy, rules]
|
||||||
|
stage: publish
|
||||||
|
script:
|
||||||
|
- cp "$SSH_PRIVATE_KEY" ~/.ssh/bot
|
||||||
|
- chmod 600 ~/.ssh/bot
|
||||||
|
- ssh-keyscan -H ${SERVER} >> ~/.ssh/known_hosts
|
||||||
|
- ssh -i ~/.ssh/bot flohoss@${SERVER} "cd /opt/docker/home && docker compose pull && docker compose up -d"
|
||||||
|
|
Loading…
Reference in a new issue