DRF_Template/.woodpecker.yml

34 lines
1.4 KiB
YAML
Raw Normal View History

2024-09-01 19:36:33 +08:00
# .woodpecker.yml
steps:
- name: build
image: docker
when:
- branch: master
event: push
commands:
2024-09-05 16:34:50 +08:00
- docker build --platform linux/arm64 --no-cache -t git.keannu1.duckdns.org/keannu125/drf_template .
2024-09-01 19:36:33 +08:00
- echo "$REGISTRY_PASSWORD" | docker login git.keannu1.duckdns.org --password-stdin -u "$REGISTRY_USERNAME"
- docker push git.keannu1.duckdns.org/keannu125/drf_template
volumes:
- /var/run/docker.sock:/var/run/docker.sock
secrets: [REGISTRY_USERNAME, REGISTRY_PASSWORD]
- name: deploy
image: docker
when:
- branch: master
event: push
commands:
2024-09-05 14:09:25 +08:00
- mkdir -p /root/.ssh/
2024-09-01 19:36:33 +08:00
- echo "$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
2024-09-05 14:09:25 +08:00
- ssh $"REMOTE_HOST" '
2024-09-01 19:36:33 +08:00
cd "/mnt/nvme/files/docker projects/DRF-Template";
docker-compose -f docker-compose.demo.yml down;
docker image rm git.keannu1.duckdns.org/keannu125/drf_template || true;
docker volume rm drf_template_db_data || true;
docker pull git.keannu1.duckdns.org/keannu125/drf_template:latest;
2024-09-05 16:34:50 +08:00
curl "https://raw.githubusercontent.com/lemeow125/DRF_Template/master/docker-compose.demo.yml" | tee docker-compose.demo.yml > /dev/null
2024-09-01 19:36:33 +08:00
docker compose -f docker-compose.demo.yml up -d;'
2024-09-05 14:06:29 +08:00
secrets: [SSH_KEY, REMOTE_HOST]