Files
dockezr/docker-compose.yml
T
2025-10-14 13:00:02 +04:00

98 lines
2.1 KiB
YAML

version: '3.8'
services:
# Base de données PostgreSQL
db:
image: postgres:16-alpine
container_name: dockezr_db
restart: always
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: dockezr
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- dockezr_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d dockezr"]
interval: 10s
timeout: 5s
retries: 5
# Backend FastAPI
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: dockezr_backend
restart: always
environment:
DATABASE_URL: postgresql://user:password@db:5432/dockezr
ports:
- "8000:8000"
volumes:
- ./backend:/app
depends_on:
db:
condition: service_healthy
networks:
- dockezr_network
command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# Frontend Next.js
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: dockezr_frontend
restart: always
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
- /app/.next
depends_on:
- backend
networks:
- dockezr_network
# Service de test
test:
build:
context: ./backend
dockerfile: Dockerfile.test
container_name: dockezr_test
environment:
DATABASE_URL: postgresql://user:password@db:5432/dockezr
API_BASE_URL: http://backend:8000
depends_on:
db:
condition: service_healthy
backend:
condition: service_started
networks:
- dockezr_network
command: >
sh -c "echo '⏳ Attente du backend...' &&
sleep 15 &&
echo '🧪 Lancement des tests...' &&
pytest test_api.py -v --tb=short"
profiles:
- test
networks:
dockezr_network:
driver: bridge
name: dockezr_network
volumes:
postgres_data:
name: dockezr_postgres_data