Add Woodpecker CI pipeline
This commit is contained in:
54
.woodpecker.yml
Normal file
54
.woodpecker.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
# Woodpecker CI Pipeline for Soleprint
|
||||
# Showcases custom build step: generates deployable code from templates
|
||||
|
||||
steps:
|
||||
# Custom step: Generate deployable code from soleprint templates
|
||||
# build.py assembles the soleprint instance for a specific config (amar)
|
||||
generate:
|
||||
image: python:3.11-slim
|
||||
commands:
|
||||
- pip install pyyaml jinja2
|
||||
- python build.py -cfg amar
|
||||
- ls -la gen/
|
||||
|
||||
# Build Docker image from generated code
|
||||
build:
|
||||
image: docker:24-dind
|
||||
commands:
|
||||
- cd gen
|
||||
- docker build -t registry.mcrn.ar/soleprint:$${CI_COMMIT_SHA:0:7} .
|
||||
- docker tag registry.mcrn.ar/soleprint:$${CI_COMMIT_SHA:0:7} registry.mcrn.ar/soleprint:latest
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
|
||||
# Push to private registry
|
||||
push:
|
||||
image: docker:24-dind
|
||||
commands:
|
||||
- docker push registry.mcrn.ar/soleprint:$${CI_COMMIT_SHA:0:7}
|
||||
- docker push registry.mcrn.ar/soleprint:latest
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
|
||||
# Deploy to server
|
||||
deploy:
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host: mcrn.ar
|
||||
username: mariano
|
||||
key:
|
||||
from_secret: deploy_key
|
||||
script:
|
||||
- cd ~/soleprint/gen
|
||||
- docker pull registry.mcrn.ar/soleprint:latest
|
||||
- docker compose down || true
|
||||
- docker compose up -d
|
||||
when:
|
||||
event: push
|
||||
branch: main
|
||||
Reference in New Issue
Block a user