This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
---
|
||||
# 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:
|
||||
# ── Stap 1: Backend image bouwen ─────────────────────────────────────────────
|
||||
- name: build-backend
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
settings:
|
||||
repo: registry.smulders.online/trading-bot-backend
|
||||
registry: registry.smulders.online
|
||||
username:
|
||||
from_secret: REGISTRY_USER
|
||||
password:
|
||||
from_secret: REGISTRY_PASS
|
||||
dockerfile: backend/Dockerfile
|
||||
context: backend
|
||||
tags:
|
||||
- latest
|
||||
- ${CI_COMMIT_SHA:0:8}
|
||||
# Geen TLS verificatie nodig want Traefik regelt het certificaat
|
||||
insecure: false
|
||||
|
||||
# ── Stap 2: Frontend image bouwen ────────────────────────────────────────────
|
||||
- name: build-frontend
|
||||
image: woodpeckerci/plugin-docker-buildx
|
||||
settings:
|
||||
repo: registry.smulders.online/trading-bot-frontend
|
||||
registry: registry.smulders.online
|
||||
username:
|
||||
from_secret: REGISTRY_USER
|
||||
password:
|
||||
from_secret: REGISTRY_PASS
|
||||
dockerfile: frontend/Dockerfile
|
||||
context: frontend
|
||||
tags:
|
||||
- latest
|
||||
- ${CI_COMMIT_SHA:0:8}
|
||||
insecure: false
|
||||
|
||||
# ── 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"
|
||||
Reference in New Issue
Block a user