feat: serve app with gunicorn

This commit is contained in:
Christian Krakau-Louis
2026-05-17 16:45:19 +02:00
parent 567159ed29
commit ae8ec413d3
4 changed files with 20 additions and 5 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ RUN pip install --no-cache-dir -r requirements.txt
# The .dockerignore file ensures we only include what's specified # The .dockerignore file ensures we only include what's specified
COPY musicround/ ./musicround/ COPY musicround/ ./musicround/
COPY migrations/ ./migrations/ COPY migrations/ ./migrations/
COPY run_migration.py run.py docker-entrypoint.sh LICENSE favicon.ico . COPY run_migration.py run.py wsgi.py docker-entrypoint.sh LICENSE favicon.ico .
# Make the entrypoint script executable # Make the entrypoint script executable
RUN chmod +x docker-entrypoint.sh RUN chmod +x docker-entrypoint.sh
@@ -31,4 +31,4 @@ ENV PYTHONPATH=/app
ENV FLASK_APP=run.py ENV FLASK_APP=run.py
# Use the entrypoint script # Use the entrypoint script
CMD ["./docker-entrypoint.sh"] CMD ["./docker-entrypoint.sh"]
+13 -2
View File
@@ -23,7 +23,18 @@ case "${FLASK_DEBUG,,}" in
exec python -m flask run --host=0.0.0.0 --port=5000 --reload --debug exec python -m flask run --host=0.0.0.0 --port=5000 --reload --debug
;; ;;
*) *)
echo "Starting Flask application server..." : "${GUNICORN_BIND:=0.0.0.0:5000}"
exec python run.py : "${GUNICORN_WORKERS:=2}"
: "${GUNICORN_THREADS:=4}"
: "${GUNICORN_TIMEOUT:=120}"
echo "Starting Gunicorn application server..."
exec gunicorn \
--bind "$GUNICORN_BIND" \
--workers "$GUNICORN_WORKERS" \
--threads "$GUNICORN_THREADS" \
--timeout "$GUNICORN_TIMEOUT" \
--access-logfile - \
--error-logfile - \
wsgi:app
;; ;;
esac esac
+2 -1
View File
@@ -17,9 +17,10 @@ Flask-Mail
Flask-Session Flask-Session
authlib>=1.6.5 authlib>=1.6.5
Flask-Caching Flask-Caching
gunicorn
psutil psutil
# Testing dependencies # Testing dependencies
pytest>=7.4.0 pytest>=7.4.0
pytest-cov>=4.1.0 pytest-cov>=4.1.0
pytest-flask>=1.2.0 pytest-flask>=1.2.0
+3
View File
@@ -0,0 +1,3 @@
from musicround import create_app
app = create_app()