multimodal_module / Dockerfile
Princeaka's picture
Update Dockerfile
31382ae verified
raw
history blame
1.13 kB
# ---------------------------
# Frontend Stage (React + Vite + Tailwind)
# ---------------------------
FROM node:20-alpine AS frontend
WORKDIR /ui
# Copy only package files first (better caching)
COPY frontend/package*.json ./
# Install dependencies (more forgiving than npm ci)
RUN npm install --silent
# Copy frontend source code
COPY frontend ./
# Build frontend
RUN npm run build
# ---------------------------
# Backend Stage (Python + FastAPI)
# ---------------------------
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Install OS dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends curl ca-certificates git && \
rm -rf /var/lib/apt/lists/*
# Copy and install Python dependencies
COPY requirements.txt ./
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
# Expose port
EXPOSE 7860
# Start server
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]