recipe-manager/docker-compose.yml

57 lines
1.4 KiB
YAML

version: '3.8'
services:
# Backend API server
backend:
build:
context: .
dockerfile: Dockerfile
container_name: recipe-manager-backend
ports:
- "3000:3000" # Expose for direct API access (optional, can remove if only accessed via frontend)
volumes:
- recipe-data:/app/data # Persist SQLite database
environment:
NODE_ENV: production
DATABASE_PATH: /app/data/recipes.db
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/api/recipes"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
restart: unless-stopped
networks:
- recipe-network
# Frontend (React + nginx)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: recipe-manager-frontend
ports:
- "8080:80" # Access app at http://localhost:8080
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 5s
restart: unless-stopped
networks:
- recipe-network
volumes:
# Named volume for SQLite database persistence
recipe-data:
driver: local
networks:
# Internal network for service communication
recipe-network:
driver: bridge