multimodal_module / Dockerfile
Princeaka's picture
Update Dockerfile
be12ec3 verified
raw
history blame
1.24 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) ---
# Use full Debian image for compatibility with Python packages
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.txt ./
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# 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"]