mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 04:09:25 +08:00
30 lines
801 B
YAML
30 lines
801 B
YAML
steps:
|
|
- name: deploy
|
|
image: docker
|
|
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
|