freedge/docker-compose.yml
ordinarthur 64df5db077 fix(ai): robust image pipeline + local MinIO stack + TS errors fix
Image generation:
- Automatic model fallback: try gpt-image-1 first, fall back to
  dall-e-3 if it fails (e.g. org not verified on OpenAI)
- Local filesystem fallback: if MinIO upload fails, write the image
  to backend/uploads/recipes/ and return a URL served by fastify-static
- Unified handling of base64 vs URL responses from the Images API
- DALL-E quality mapped automatically (low/medium/high -> standard)

Local MinIO stack:
- docker-compose.yml at repo root with minio + minio-init service
  that auto-creates the bucket and makes it publicly readable
- Default credentials: freedge / freedge123 (configurable)
- Console at :9001, API at :9000
- .env.example now points to the local stack by default

Static file serving:
- Register @fastify/static to serve ./uploads at /uploads/*
- Enables local fallback to return usable URLs to the frontend
- New PUBLIC_BASE_URL env var to build absolute URLs

TypeScript errors (21 -> 0):
- JWT typing via '@fastify/jwt' module augmentation (FastifyJWT
  interface with payload + user) fixes all request.user.id errors
- Stripe constructor now passes required StripeConfig
- fastify.createCustomer guards checked on the helper itself for
  proper TS narrowing (not on fastify.stripe)
- Remove 'done' arg from async onClose hook
- MinIO transport.agent + listFiles return type cast ignored

README:
- Add 'Stockage des fichiers' section explaining the two modes
- Updated setup instructions to start with docker compose up

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-08 12:30:47 +02:00

43 lines
1.2 KiB
YAML

services:
minio:
image: minio/minio:latest
container_name: freedge-minio
ports:
- "9000:9000" # API S3
- "9001:9001" # Console web
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-freedge}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-freedge123}
volumes:
- minio-data:/data
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "mc", "ready", "local"]
interval: 5s
timeout: 5s
retries: 5
# Crée le bucket automatiquement au démarrage
minio-init:
image: minio/mc:latest
container_name: freedge-minio-init
depends_on:
minio:
condition: service_healthy
environment:
MINIO_ROOT_USER: ${MINIO_ROOT_USER:-freedge}
MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-freedge123}
MINIO_BUCKET: ${MINIO_BUCKET:-freedge}
entrypoint: >
/bin/sh -c "
set -e;
mc alias set local http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD;
mc mb --ignore-existing local/$$MINIO_BUCKET;
mc anonymous set download local/$$MINIO_BUCKET;
echo 'Bucket '$$MINIO_BUCKET' prêt et lisible publiquement';
"
volumes:
minio-data:
driver: local