mediastorm / Dockerfile
remdms's picture
feat: Docker multi-stage build with nginx + FastAPI
3d90e68
# Stage 1: Build frontend
FROM node:20-slim AS frontend
WORKDIR /app/frontend
COPY frontend/package.json frontend/bun.lock* frontend/package-lock.json* ./
RUN npm install
COPY frontend/ .
RUN npm run build
# Stage 2: Python backend + nginx + frontend
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends nginx && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Python deps
COPY pyproject.toml .
COPY src/ src/
RUN pip install --no-cache-dir .
# ONNX model + data
COPY models/ models/
COPY data/chromadb/ data/chromadb/
COPY data/bm25_index.pkl data/bm25_index.pkl
COPY data/ingest_cache/ data/ingest_cache/
# Frontend build
COPY --from=frontend /app/frontend/dist /usr/share/nginx/html
# Nginx config
COPY nginx.conf /etc/nginx/nginx.conf
# Entrypoint
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
EXPOSE 7860
CMD ["./entrypoint.sh"]