HEAREM / Dockerfile
CHAIMA
Initial clean commit
8d8f5f1
# Stage 1: Build Frontend
FROM node:20-slim AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Backend & Final Image
FROM python:3.9-slim
# Install system dependencies (FFmpeg is required for Whisper)
RUN apt-get update && apt-get install -y \
ffmpeg \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy backend requirements first for caching
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend code
COPY backend /app/backend
# Copy built frontend from Stage 1
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
# Expose the port (Hugging Face uses 7860 by default)
EXPOSE 7860
# Command to run the application
# We run from the backend directory so that imports work correctly
WORKDIR /app/backend
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]