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:
8
run.py
8
run.py
@@ -11,4 +11,10 @@ config_name = os.getenv('FLASK_CONFIG', 'development')
|
||||
app = create_app(config_name)
|
||||
|
||||
if __name__ == '__main__':
|
||||
socketio.run(app, debug=True, host='0.0.0.0', port=5000)
|
||||
debug_mode = os.getenv('FLASK_ENV', 'development') == 'development'
|
||||
|
||||
# For production deployment, allow unsafe werkzeug or use a proper WSGI server
|
||||
if os.getenv('FLASK_ENV') == 'production':
|
||||
socketio.run(app, debug=False, host='0.0.0.0', port=5000, allow_unsafe_werkzeug=True)
|
||||
else:
|
||||
socketio.run(app, debug=debug_mode, host='0.0.0.0', port=5000)
|
Reference in New Issue
Block a user