Dockerify
This commit is contained in:
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# backend/Dockerfile
|
||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
RUN addgroup --system app && adduser --system --ingroup app app
|
||||||
|
|
||||||
|
WORKDIR /srv/app
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Assurer permissions
|
||||||
|
RUN chown -R app:app /srv/app
|
||||||
|
|
||||||
|
USER app
|
||||||
|
|
||||||
|
# Port interne
|
||||||
|
EXPOSE 5000
|
||||||
|
|
||||||
|
# Variable d'environnement par défaut
|
||||||
|
ENV FLASK_ENV=production
|
||||||
|
ENV GUNICORN_WORKERS=3
|
||||||
|
ENV GUNICORN_THREADS=2
|
||||||
|
|
||||||
|
# Commande de démarrage via gunicorn (attache l'app Flask : app:app)
|
||||||
|
# Utilise timeout raisonnable, bind sur 0.0.0.0:5000
|
||||||
|
CMD ["sh", "-c", "gunicorn --workers ${GUNICORN_WORKERS} --threads ${GUNICORN_THREADS} --bind 0.0.0.0:5000 --access-logfile - --error-logfile - 'main:app'"]
|
||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
Reference in New Issue
Block a user