feat: switch to Gunicorn for production
This commit is contained in:
@@ -30,9 +30,10 @@ RUN uv venv && \
|
|||||||
ENV FLASK_APP=main.py
|
ENV FLASK_APP=main.py
|
||||||
ENV FLASK_ENV=production
|
ENV FLASK_ENV=production
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
ENV GUNICORN_CMD_ARGS="--workers=4 --bind=0.0.0.0:5000 --timeout=120"
|
||||||
|
|
||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
# Run the application
|
# Run the application with Gunicorn
|
||||||
CMD ["python", "main.py"]
|
CMD ["gunicorn", "main:app"]
|
||||||
@@ -11,6 +11,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- FLASK_APP=main.py
|
- FLASK_APP=main.py
|
||||||
- FLASK_ENV=production
|
- FLASK_ENV=production
|
||||||
|
- GUNICORN_CMD_ARGS=--workers=4 --bind=0.0.0.0:5000 --timeout=120
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost:5000"]
|
test: ["CMD", "curl", "-f", "http://localhost:5000"]
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ dependencies = [
|
|||||||
"flask>=3.0.0",
|
"flask>=3.0.0",
|
||||||
"werkzeug>=3.0.0",
|
"werkzeug>=3.0.0",
|
||||||
"python-dotenv>=1.0.0",
|
"python-dotenv>=1.0.0",
|
||||||
|
"gunicorn>=21.2.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
|
|||||||
Reference in New Issue
Block a user