Update file .gitlab-ci.yml

This commit is contained in:
Lee 2023-01-14 00:21:01 +00:00
parent b9844c121a
commit 98bea3f421

@ -1,26 +1,24 @@
publish: stages:
image: docker:latest - First
stage: build - Second
variables:
DOCKER_DRIVER: overlay
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- main
deploy: cache:
image: alpine:latest key: ${CI_COMMIT_REF_SLUG}
stage: deploy paths:
tags: - workdir/
First:
stage: First
image:
name: docker:latest
entrypoint: ["/bin/sh", "-c"]
script: script:
- chmod og= $ID_RSA - mkdir -p workdir
- apk update && apk add openssh-client - echo "asdf" > workdir/r.txt
- 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 Second:
url: https://bs-overlay.fascinated.cc stage: Second
only: image: alpine
- main script:
- cat workdir/r.txt