52 lines
1.3 KiB
YAML
52 lines
1.3 KiB
YAML
pipeline:
|
|
build:
|
|
image: woodpeckerci/plugin-docker-buildx
|
|
settings:
|
|
repo: registry.example.com/ploughshares
|
|
registry: registry.example.com
|
|
tags:
|
|
- latest
|
|
- "${CI_COMMIT_TAG##v}"
|
|
- "${CI_COMMIT_BRANCH}"
|
|
dockerfile: docker/ploughshares/Dockerfile
|
|
platforms:
|
|
- linux/amd64
|
|
- linux/arm64
|
|
secrets: [ docker_username, docker_password ]
|
|
when:
|
|
event: [push, tag]
|
|
branch: [main, master]
|
|
|
|
deploy:
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host:
|
|
from_secret: ssh_host
|
|
username:
|
|
from_secret: ssh_username
|
|
key:
|
|
from_secret: ssh_key
|
|
port: 22
|
|
script:
|
|
- cd /path/to/deployment
|
|
- docker stack deploy -c stack.production.yml ploughshares
|
|
when:
|
|
event: [push, tag]
|
|
branch: [main, master]
|
|
|
|
notify:
|
|
image: plugins/slack
|
|
settings:
|
|
webhook:
|
|
from_secret: slack_webhook
|
|
channel: deployments
|
|
template: >
|
|
{{#success build.status}}
|
|
Build {{build.number}} succeeded. Project Ploughshares has been deployed successfully.
|
|
{{else}}
|
|
Build {{build.number}} failed. Please check the logs for more details.
|
|
{{/success}}
|
|
when:
|
|
status: [success, failure]
|
|
event: [push, tag]
|
|
branch: [main, master] |