- 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
1.5 KiB
1.5 KiB
Docker Deployment for Markov Economics Simulation
This directory contains Docker configuration files for containerizing the Markov Economics Simulation App.
Files
Dockerfile
- Multi-stage Docker build configurationdocker-compose.yml
- Docker Compose configuration for easy deployment.dockerignore
- Files to exclude from Docker build context
Quick Start
Using Docker Compose (Recommended)
# Build and start the application
docker-compose up --build
# Run in detached mode
docker-compose up -d --build
# Stop the application
docker-compose down
Using Docker directly
# Build the image
docker build -t markov-economics .
# Run the container
docker run -p 5000:5000 markov-economics
# Run with environment variables
docker run -p 5000:5000 \
-e FLASK_ENV=production \
-e FLASK_APP=run.py \
markov-economics
Access
Once running, the application will be available at:
- Main application: http://localhost:5000
- Health check: http://localhost:5000/health
Configuration
Environment Variables
FLASK_ENV
- Flask environment (development/production)FLASK_APP
- Entry point file (run.py)PYTHONUNBUFFERED
- Ensure Python output is not buffered
Ports
5000
- Main application port (Flask + SocketIO)
Health Check
The container includes a health check that verifies the application is responding correctly at /health
.
Security
- Runs as non-root user (
appuser
) - Uses Python slim base image
- Excludes development files via
.dockerignore