ng-implementation/streamlit-dockerfile.yml

47 lines
1.1 KiB
YAML

###############################################
# Stage 1: Build Angular (angular-basic)
###############################################
FROM node:24 AS webbuild
WORKDIR /web
ENV APP_PATH=./angular-basic
COPY angular-basic/package*.json ./
RUN npm ci || npm install
COPY angular-basic/ ./
RUN npm run build -- --configuration=production
###############################################
# Stage 2: Python API (FastAPI)
###############################################
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Installer nginx pour servir l'UI
RUN apt-get update && apt-get install -y --no-install-recommends nginx \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# API
COPY streamlit_demo.py ./app.py
# UI statique Angular servie sous /ui
RUN mkdir -p /app/ui
COPY --from=webbuild /web/dist/angular-basic/browser /app/ui
# Nginx config et script de démarrage
COPY devops/nginx.conf /etc/nginx/nginx.conf
COPY devops/start.sh /start.sh
RUN chmod +x /start.sh
EXPOSE 80 8501
# Lance uvicorn (API) et nginx (UI/proxy)
CMD ["/bin/sh","-c","/start.sh"]