build: Docker-Images, Compose-Setup und Gitea-Workflows
- Mehrstufige Dockerfiles je Dienst mit Stufen für Entwicklung und Betrieb, beide Images laufen als unprivilegierter Benutzer - Backend-Entrypoint wartet auf die Datenbank, migriert und seedt nur bei leerem Kategoriebaum (neues Flag --if-empty) - docker-compose.yml mit Netz-Trennung, Healthchecks und benannten Volumes; die Datenbank ist ausschließlich im internen Netz erreichbar - nginx liefert das Bundle aus und reicht /api weiter; index.html ungecacht, gehashte Assets ein Jahr - Gitea-Workflows: ci.yml für Lint, Tests und Bundle-Bau, build.yml für die Images nach linux/amd64 ohne Deploy-Schritt - docs/runner.md und docs/deployment.md, .dockerignore je Dienst Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014e7t8UpmoVNMtWivY5LiSH
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
name: CI
|
||||
|
||||
# Läuft bei jedem Push und jedem Pull Request, unabhängig vom Branch.
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
backend:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: backend
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
env:
|
||||
POSTGRES_DB: moneyfy_test
|
||||
POSTGRES_USER: moneyfy
|
||||
POSTGRES_PASSWORD: moneyfy
|
||||
options: >-
|
||||
--health-cmd "pg_isready -U moneyfy -d moneyfy_test"
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 10
|
||||
|
||||
env:
|
||||
# Die Tests lesen DATABASE_URL; der Dienst ist unter seinem Namen erreichbar.
|
||||
DATABASE_URL: postgresql+asyncpg://moneyfy:moneyfy@postgres:5432/moneyfy_test
|
||||
SECRET_KEY: ci-secret-key-mindestens-32-zeichen-lang
|
||||
ENVIRONMENT: test
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: uv installieren
|
||||
run: |
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Abhängigkeiten installieren
|
||||
# uv lädt bei Bedarf auch den passenden Python-Interpreter.
|
||||
run: |
|
||||
uv venv --python 3.12 .venv
|
||||
uv pip install -e ".[dev]"
|
||||
|
||||
- name: ruff check
|
||||
run: .venv/bin/ruff check .
|
||||
|
||||
- name: ruff format
|
||||
run: .venv/bin/ruff format --check .
|
||||
|
||||
- name: pytest
|
||||
run: .venv/bin/python -m pytest -q
|
||||
|
||||
frontend:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
cache: npm
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Abhängigkeiten installieren
|
||||
run: npm ci --no-audit --no-fund
|
||||
|
||||
- name: Typen prüfen
|
||||
run: npm run typecheck
|
||||
|
||||
- name: eslint
|
||||
run: npm run lint
|
||||
|
||||
- name: vitest
|
||||
run: npm run test
|
||||
|
||||
- name: Bundle bauen
|
||||
run: npx vite build
|
||||
Reference in New Issue
Block a user