FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

# Crée le dossier de données
RUN mkdir -p /data

# Lance l'init DB et le serveur
CMD ["sh", "-c", "python -c 'from app import init_db; init_db()' && python app.py"]

EXPOSE 5000
