Some checks failed
Build and Publish Docker Images / build-and-push (push) Has been cancelled
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
# Dockerfile pour Notytex - Système de Gestion Scolaire
|
|
FROM python:3.11-slim-bookworm
|
|
|
|
# Variables d'environnement pour uv et Flask
|
|
ENV UV_COMPILE_BYTECODE=1
|
|
ENV UV_LINK_MODE=copy
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
ENV FLASK_APP=app
|
|
ENV FLASK_ENV=production
|
|
|
|
# Installation d'uv depuis l'image officielle
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
|
|
# Installation des dépendances avec cache mount (avant changement d'utilisateur)
|
|
WORKDIR /app
|
|
COPY pyproject.toml uv.lock ./
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
uv sync --frozen --no-dev
|
|
|
|
# Création d'un utilisateur non-root
|
|
RUN adduser --disabled-password --gecos '' --shell /bin/bash notytex \
|
|
&& chown -R notytex:notytex /app
|
|
USER notytex
|
|
|
|
# Définition du répertoire de travail
|
|
WORKDIR /app
|
|
|
|
# Copie du code source
|
|
COPY --chown=notytex:notytex . .
|
|
|
|
# Création des répertoires nécessaires (volumes seront montés)
|
|
RUN mkdir -p instance logs
|
|
|
|
# Exposition du port Flask
|
|
EXPOSE 5000
|
|
|
|
# Démarrage de l'application (stateless)
|
|
CMD ["uv", "run", "flask", "--app", "app", "run", "--host=0.0.0.0", "--port=5000"] |