60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
---
|
|
# Woodpecker CI pipeline voor trading_bot
|
|
# Triggered bij elke push naar main
|
|
# Bouwt backend + frontend images en pusht naar lokale registry
|
|
|
|
when:
|
|
branch: main
|
|
event: [push, manual]
|
|
|
|
steps:
|
|
- name: docker-login
|
|
image: docker:cli
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
environment:
|
|
REGISTRY_USER:
|
|
from_secret: registry_user
|
|
REGISTRY_PASS:
|
|
from_secret: registry_pass
|
|
commands:
|
|
- docker login registry.smulders.online -u $REGISTRY_USER -p $REGISTRY_PASS
|
|
dns:
|
|
- 192.168.0.113
|
|
- 1.1.1.1
|
|
|
|
- name: build-backend
|
|
image: docker:cli
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- docker build -t registry.smulders.online/trading-bot-backend:latest -f backend/Dockerfile backend
|
|
- docker push registry.smulders.online/trading-bot-backend:latest
|
|
|
|
- name: build-frontend
|
|
image: docker:cli
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
commands:
|
|
- docker build -t registry.smulders.online/trading-bot-frontend:latest -f frontend/Dockerfile frontend
|
|
- docker push registry.smulders.online/trading-bot-frontend:latest
|
|
|
|
# ── Stap 3: Portainer stack herdeploy triggeren ───────────────────────────────
|
|
- name: deploy
|
|
image: curlimages/curl:latest
|
|
environment:
|
|
PORTAINER_TOKEN:
|
|
from_secret: PORTAINER_TOKEN
|
|
PORTAINER_URL:
|
|
from_secret: PORTAINER_URL
|
|
PORTAINER_STACK_ID:
|
|
from_secret: PORTAINER_STACK_ID
|
|
commands:
|
|
- |
|
|
curl -s -X POST \
|
|
"$PORTAINER_URL/api/stacks/$PORTAINER_STACK_ID/git/redeploy" \
|
|
-H "X-API-Key: $PORTAINER_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"pullImage": true}' \
|
|
| grep -q '"Id"' && echo "✓ Deploy getriggerd" || echo "✗ Deploy mislukt"
|