multimodal_module / Dockerfile
Princeaka's picture
Update Dockerfile
a61db76 verified
raw
history blame
1.5 kB
# --- Frontend Stage (React + Vite) ---
FROM node:20-alpine AS frontend
WORKDIR /ui
# Copy package files and install dependencies
COPY frontend/package*.json ./
RUN npm ci --silent || npm install --silent
# Copy frontend source and build
COPY frontend ./
RUN npm run build
# --- Backend Stage (FastAPI + Python) ---
FROM python:3.11-bullseye
WORKDIR /app
# Install system dependencies often required for Python packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
ffmpeg \
libsm6 \
libxext6 \
cmake \
libgl1-mesa-glx \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY requirements-small.txt ./requirements-small.txt
# Only copy large if it exists
COPY requirements-large.txt ./requirements-large.txt 2>/dev/null || true
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements-small.txt
# Install large requirements if file exists
RUN [ -f requirements-large.txt ] && pip install --no-cache-dir -r requirements-large.txt || echo "No large requirements to install"
# Copy backend code
COPY backend ./backend
COPY app.py Procfile .env.example ./
# Copy built frontend from frontend stage
COPY --from=frontend /ui/dist ./frontend_dist
# Bust cache so Hugging Face doesn’t reuse stale Node layers
ARG CACHE_BUST=1
EXPOSE 7860
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]