core: add ci
Some checks failed
Build and Publish Docker Images / build-and-push (push) Has been cancelled

This commit is contained in:
2025-09-17 09:59:37 +02:00
parent ad27f1d5e6
commit 5d993e9e14
4 changed files with 150 additions and 0 deletions

39
Dockerfile Normal file
View File

@@ -0,0 +1,39 @@
# 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"]