Update file .gitlab-ci.yml
This commit is contained in:
parent
98bea3f421
commit
a616518113
@ -1,24 +1,31 @@
|
|||||||
stages:
|
|
||||||
- First
|
|
||||||
- Second
|
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
key: ${CI_COMMIT_REF_SLUG}
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
paths:
|
paths:
|
||||||
- workdir/
|
- workdir/
|
||||||
|
|
||||||
First:
|
publish:
|
||||||
stage: First
|
image: docker:latest
|
||||||
image:
|
stage: build
|
||||||
name: docker:latest
|
variables:
|
||||||
entrypoint: ["/bin/sh", "-c"]
|
DOCKER_DRIVER: overlay
|
||||||
|
before_script:
|
||||||
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
script:
|
script:
|
||||||
- mkdir -p workdir
|
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||||
- echo "asdf" > workdir/r.txt
|
- docker push "$CI_REGISTRY_IMAGE"
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
|
||||||
|
deploy:
|
||||||
Second:
|
image: alpine:latest
|
||||||
stage: Second
|
stage: deploy
|
||||||
image: alpine
|
tags:
|
||||||
script:
|
script:
|
||||||
- cat workdir/r.txt
|
- chmod og= $ID_RSA
|
||||||
|
- apk update && apk add openssh-client
|
||||||
|
- ssh -i $ID_RSA -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd /home/overlay && docker compose pull && docker compose up -d && docker image prune -f"
|
||||||
|
environment:
|
||||||
|
name: production
|
||||||
|
url: https://bs-overlay.fascinated.cc
|
||||||
|
only:
|
||||||
|
- main
|
Reference in New Issue
Block a user