refactor(docker): simplify docker-compose.yml configuration
- Remove deprecated version field - Keep only essential services: dev, prod, cli - Remove complex services: test, docs, nginx, monitoring - Remove custom networks for simplicity - Focus on core application containers - Update service configurations for simplified Dockerfile
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
# UnitForge Docker Compose Configuration
|
# UnitForge Docker Compose Configuration
|
||||||
# Provides easy development and production deployment options
|
# Simple configuration for building and running the application
|
||||||
|
|
||||||
version: "3.8"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Development service with hot reload
|
# Development service with hot reload
|
||||||
@@ -9,11 +7,9 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
target: development
|
|
||||||
container_name: unitforge-dev
|
container_name: unitforge-dev
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
- "8001:8001" # Alternative port for testing
|
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app
|
- .:/app
|
||||||
- /app/.venv # Exclude venv from bind mount
|
- /app/.venv # Exclude venv from bind mount
|
||||||
@@ -27,8 +23,6 @@ services:
|
|||||||
- RELOAD=true
|
- RELOAD=true
|
||||||
- PYTHONPATH=/app/backend
|
- PYTHONPATH=/app/backend
|
||||||
command: ["./start-server.sh", "--host", "0.0.0.0", "--log-level", "debug"]
|
command: ["./start-server.sh", "--host", "0.0.0.0", "--log-level", "debug"]
|
||||||
networks:
|
|
||||||
- unitforge-network
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -36,12 +30,11 @@ services:
|
|||||||
retries: 3
|
retries: 3
|
||||||
start_period: 40s
|
start_period: 40s
|
||||||
|
|
||||||
# Production-like service
|
# Production service
|
||||||
unitforge-prod:
|
unitforge-prod:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
target: production
|
|
||||||
container_name: unitforge-prod
|
container_name: unitforge-prod
|
||||||
ports:
|
ports:
|
||||||
- "8080:8000"
|
- "8080:8000"
|
||||||
@@ -51,8 +44,9 @@ services:
|
|||||||
- DEBUG=false
|
- DEBUG=false
|
||||||
- LOG_LEVEL=info
|
- LOG_LEVEL=info
|
||||||
- RELOAD=false
|
- RELOAD=false
|
||||||
networks:
|
- PYTHONPATH=/app/backend
|
||||||
- unitforge-network
|
command:
|
||||||
|
["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||||
interval: 30s
|
interval: 30s
|
||||||
@@ -66,7 +60,6 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
target: cli-only
|
|
||||||
container_name: unitforge-cli
|
container_name: unitforge-cli
|
||||||
volumes:
|
volumes:
|
||||||
- ./output:/output # Mount for output files
|
- ./output:/output # Mount for output files
|
||||||
@@ -74,101 +67,12 @@ services:
|
|||||||
working_dir: /app
|
working_dir: /app
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
networks:
|
environment:
|
||||||
- unitforge-network
|
- PYTHONPATH=/app/backend
|
||||||
|
entrypoint: ["./unitforge-cli"]
|
||||||
profiles:
|
profiles:
|
||||||
- cli
|
- cli
|
||||||
|
|
||||||
# Test runner service
|
|
||||||
unitforge-test:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
target: development
|
|
||||||
container_name: unitforge-test
|
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
- /app/.venv
|
|
||||||
- test-results:/app/test-results
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
|
||||||
- PYTHONPATH=/app/backend
|
|
||||||
command:
|
|
||||||
[
|
|
||||||
"python",
|
|
||||||
"-m",
|
|
||||||
"pytest",
|
|
||||||
"tests/",
|
|
||||||
"-v",
|
|
||||||
"--junitxml=/app/test-results/junit.xml",
|
|
||||||
"--cov=backend",
|
|
||||||
"--cov-report=html:/app/test-results/htmlcov",
|
|
||||||
]
|
|
||||||
networks:
|
|
||||||
- unitforge-network
|
|
||||||
profiles:
|
|
||||||
- test
|
|
||||||
|
|
||||||
# Documentation service (for future use)
|
|
||||||
unitforge-docs:
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
target: development
|
|
||||||
container_name: unitforge-docs
|
|
||||||
ports:
|
|
||||||
- "8002:8000"
|
|
||||||
volumes:
|
|
||||||
- .:/app
|
|
||||||
- /app/.venv
|
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
|
||||||
- PYTHONPATH=/app/backend
|
|
||||||
command:
|
|
||||||
[
|
|
||||||
"python",
|
|
||||||
"-c",
|
|
||||||
"from backend.app.main import app; import uvicorn; uvicorn.run(app, host='0.0.0.0', port=8000, reload=True)",
|
|
||||||
]
|
|
||||||
networks:
|
|
||||||
- unitforge-network
|
|
||||||
profiles:
|
|
||||||
- docs
|
|
||||||
|
|
||||||
# Load balancer for production (nginx)
|
|
||||||
nginx:
|
|
||||||
image: nginx:alpine
|
|
||||||
container_name: unitforge-nginx
|
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
volumes:
|
|
||||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
||||||
- ./ssl:/etc/nginx/ssl:ro
|
|
||||||
depends_on:
|
|
||||||
- unitforge-prod
|
|
||||||
networks:
|
|
||||||
- unitforge-network
|
|
||||||
profiles:
|
|
||||||
- production
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
networks:
|
|
||||||
unitforge-network:
|
|
||||||
driver: bridge
|
|
||||||
name: unitforge-network
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
test-results:
|
|
||||||
driver: local
|
|
||||||
node_modules:
|
|
||||||
driver: local
|
|
||||||
# Override configurations for different environments
|
|
||||||
# Usage examples:
|
# Usage examples:
|
||||||
# Development: docker-compose up unitforge-dev
|
# Development: docker-compose up unitforge-dev
|
||||||
# Production: docker-compose --profile production up
|
# Production: docker-compose up unitforge-prod
|
||||||
# CLI only: docker-compose --profile cli run --rm unitforge-cli --help
|
# CLI only: docker-compose --profile cli run --rm unitforge-cli --help
|
||||||
# Run tests: docker-compose --profile test up unitforge-test
|
|
||||||
# With nginx: docker-compose --profile production up nginx unitforge-prod
|
|
||||||
|
|||||||
Reference in New Issue
Block a user