1
0
forked from EHV/sejeteralo

Migrate CI to single-step DinD with Fabio/Consul

Replace 5-step pipeline (build/test/push/push/deploy) with single
docker:dind step that builds and deploys in-place via Docker socket.

- .woodpecker.yml: single-step DinD, 1 secret (SECRET_KEY)
- docker-compose.fabio.yml: overlay with SERVICE_* labels for Registrator
- docker-compose.yml: add ports without host bind (Fabio/Traefik routing)
- docker-compose.dev.yml: named volumes with bind driver
- Dockerfiles: install curl, HEALTHCHECK via curl /api/health
- Makefile: docker-fabio, consul-services, fabio-routes targets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
syoul
2026-03-13 18:15:12 +01:00
parent ff901064e9
commit 45253ba705
7 changed files with 71 additions and 62 deletions

View File

@@ -3,61 +3,20 @@ when:
event: push
steps:
build-frontend:
image: node:20-slim
- name: build
image: docker:dind
environment:
COMPOSE_PROJECT_NAME: ${CI_REPO_OWNER,,}-${CI_REPO_NAME,,}-${CI_COMMIT_BRANCH//\//-}
DOMAIN: sejeteralo.org
LETSENCRYPT_HOST: sejeteralo.org
SERVICE_8000_TAGS: urlprefix-sejeteralo.org:443/api
SERVICE_3000_TAGS: urlprefix-sejeteralo.org:443/*
SECRET_KEY:
from_secret: SECRET_KEY
commands:
- cd frontend && npm ci && npm run build
build-backend:
image: python:3.11-slim
commands:
- pip install -r backend/requirements.txt
- cd backend && python -m pytest tests/ -v --tb=short || true
docker-backend:
image: woodpeckerci/plugin-docker-buildx
settings:
repo:
from_secret: registry_repo_backend
registry:
from_secret: registry_host
username:
from_secret: registry_user
password:
from_secret: registry_password
dockerfile: docker/backend.Dockerfile
target: production
tags: latest
- docker compose -f docker/docker-compose.yml -f docker/docker-compose.fabio.yml up --build -d
volumes:
- ${DOCKER_SOCKET_LOCATION:-/var/run/docker.sock}:/var/run/docker.sock
when:
status: success
docker-frontend:
image: woodpeckerci/plugin-docker-buildx
settings:
repo:
from_secret: registry_repo_frontend
registry:
from_secret: registry_host
username:
from_secret: registry_user
password:
from_secret: registry_password
dockerfile: docker/frontend.Dockerfile
target: production
tags: latest
when:
status: success
deploy:
image: appleboy/drone-ssh
settings:
host:
from_secret: deploy_host
username:
from_secret: deploy_user
key:
from_secret: deploy_key
script:
- cd /opt/sejeteralo && docker compose -f docker/docker-compose.yml pull && docker compose -f docker/docker-compose.yml up -d
when:
status: success
- branch: main
event: push