mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 04:09:25 +08:00
33 lines
1.3 KiB
YAML
33 lines
1.3 KiB
YAML
# .woodpecker.yml
|
|
steps:
|
|
- name: build-push
|
|
image: docker
|
|
when:
|
|
- branch: master
|
|
- event: push
|
|
commands:
|
|
- docker build . -t git.keannu1.duckdns.org/keannu125/drf_template
|
|
- cat "$GITEA_PASSWORD" | docker login git.keannu1.duckdns.org --username "$GITEA_USERNAME" --pasword-stdin
|
|
- docker push git.keannu1.duckdns.org/keannu125/drf_template
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
- name: update deployment and reset database
|
|
image: docker
|
|
when:
|
|
- branch: master
|
|
- event: push
|
|
commands:
|
|
- mkdir -p /root/.ssh/
|
|
- 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
|
|
- ssh root@10.0.10.4 '
|
|
cd /mnt/nvme/files/docker projects/EquipmentTracker-Backend;
|
|
docker-compose down;
|
|
docker image rm git.keannu1.duckdns.org/keannu125/drf_template;
|
|
docker volume rm git.keannu1.duckdns.org/keannu125/drf_template_db_data;
|
|
docker compose up -d'
|
|
- scp -r dist/* root@10.0.10.4:/mnt/nvme/www/equipment_tracker_frontend
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
secrets: [SSH_KEY, REGISTRY_USERNAME, REGISTRY_PASSWORD]
|