31 lines
792 B
Docker
31 lines
792 B
Docker
|
|
# 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
|
||
|
|
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"]
|