DRF_Template/.woodpecker/.deploy.yml

30 lines
806 B
YAML

steps:
- name: deploy
image: debian:12.7
when:
- branch: master
event: push
commands:
- 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