# Stage 1: build front FROM node:20-alpine AS frontend-build WORKDIR /app/frontend COPY frontend/package*.json ./ RUN npm ci COPY frontend/ ./ RUN npm run build # Stage 2: python runtime FROM python:3.12-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends \ libcairo2 \ libpango-1.0-0 \ libpangoft2-1.0-0 \ libharfbuzz0b \ libfontconfig1 \ shared-mime-info \ && rm -rf /var/lib/apt/lists/* COPY backend/requirements.txt ./backend/ RUN pip install --no-cache-dir -r backend/requirements.txt COPY backend/ ./backend/ COPY --from=frontend-build /app/frontend/dist ./backend/app/static ENV FLASK_APP=backend.app:create_app ENV PYTHONUNBUFFERED=1 ENV PYTHONPATH=/app # Variables surchargeables au `docker run` : ENV MIMIC_PORT=5000 ENV MIMIC_DB_PATH=/data/mimic.sqlite VOLUME ["/data"] EXPOSE 5000 # Entrypoint : applique les migrations Alembic puis lance Flask COPY docker/entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]