Add Docker support: Dockerfile, docker-compose.yml, and production configuration

- Add Dockerfile with multi-stage build for Flask app containerization
- Include .dockerignore to optimize build context
- Add docker-compose.yml for easy deployment with health checks
- Update run.py to handle production mode with allow_unsafe_werkzeug
- Add DOCKER.md with comprehensive deployment instructions
- Configure health check endpoint at /health
- Run as non-root user for security
- Support for environment variables and proper port mapping
This commit is contained in:
2025-08-24 19:20:38 +02:00
parent 26c82959a2
commit bec913a599
5 changed files with 205 additions and 1 deletions

31
docker-compose.yml Normal file
View File

@@ -0,0 +1,31 @@
version: '3.8'
services:
markov-economics:
build: .
ports:
- "5000:5000"
environment:
- FLASK_ENV=production
- FLASK_APP=run.py
- PYTHONUNBUFFERED=1
volumes:
# Optional: Mount for persistent data if needed
- ./data:/app/data
restart: unless-stopped
healthcheck:
test: ["CMD", "python", "-c", "import requests; requests.get('http://localhost:5000/health', timeout=2)"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- markov-network
networks:
markov-network:
driver: bridge
volumes:
markov-data:
driver: local