DRF_Template/.woodpecker/.deploy.yml

31 lines
830 B
YAML

steps:
- name: deploy
image: alpine:3.20
when:
- branch: master
event: push
commands:
- apk add openssh
- mkdir -p /root/.ssh/
- echo "$WOODPECKER_SSH_KEY" | tr -d '\r' > /root/.ssh/id_rsa
- chmod 600 /root/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
- ssh "$SSH_HOST" '
cd "$PROJECT_DIRECTORY";
docker-compose down;
docker image rm "$REGISTRY_IMAGE_TAG" || true;
docker volume rm "$DOCKER_DB_VOLUME" || true;
docker pull "$REGISTRY_IMAGE_TAG";
docker-compose up -d;
docker image prune -af;'
secrets:
[
SSH_HOST,
PROJECT_DIRECTORY,
WOODPECKER_SSH_KEY,
REGISTRY_IMAGE_TAG,
DOCKER_DB_VOLUME,
]
depends_on:
- build