feat: add environment file support to Docker Compose

- Add env_file configuration to all services for automatic .env loading
- Enable consistent environment variable management across containers
- Support development, production, CLI, and test service configurations
- Maintain backward compatibility with existing environment overrides
This commit is contained in:
William Valentin
2025-09-14 15:57:42 -07:00
parent d6851ad58e
commit b32cfcab2d

View File

@@ -19,6 +19,8 @@ services:
- /app/.venv # Exclude venv from bind mount - /app/.venv # Exclude venv from bind mount
- /app/backend/__pycache__ # Exclude cache - /app/backend/__pycache__ # Exclude cache
- /app/.pytest_cache - /app/.pytest_cache
env_file:
- .env
environment: environment:
- DEBUG=true - DEBUG=true
- LOG_LEVEL=debug - LOG_LEVEL=debug
@@ -43,6 +45,8 @@ services:
container_name: unitforge-prod container_name: unitforge-prod
ports: ports:
- "8080:8000" - "8080:8000"
env_file:
- .env
environment: environment:
- DEBUG=false - DEBUG=false
- LOG_LEVEL=info - LOG_LEVEL=info
@@ -68,6 +72,8 @@ services:
- ./output:/output # Mount for output files - ./output:/output # Mount for output files
- ./input:/input # Mount for input files - ./input:/input # Mount for input files
working_dir: /app working_dir: /app
env_file:
- .env
networks: networks:
- unitforge-network - unitforge-network
profiles: profiles:
@@ -84,6 +90,8 @@ services:
- .:/app - .:/app
- /app/.venv - /app/.venv
- test-results:/app/test-results - test-results:/app/test-results
env_file:
- .env
environment: environment:
- PYTHONPATH=/app/backend - PYTHONPATH=/app/backend
command: command:
@@ -114,6 +122,8 @@ services:
volumes: volumes:
- .:/app - .:/app
- /app/.venv - /app/.venv
env_file:
- .env
environment: environment:
- PYTHONPATH=/app/backend - PYTHONPATH=/app/backend
command: command: