| # Build Stage for Frontend | |
| FROM node:20-slim AS frontend-build | |
| WORKDIR /app/frontend | |
| COPY dubbing_frontend/package*.json ./ | |
| RUN npm install | |
| COPY dubbing_frontend/ ./ | |
| RUN npm run build | |
| # Final Stage | |
| FROM python:3.11-slim | |
| RUN apt-get update && apt-get install -y \ | |
| ffmpeg \ | |
| build-essential \ | |
| curl \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Copy Backend | |
| COPY requirements.txt ./ | |
| COPY dubbing_backend/requirements.txt ./dubbing_backend_reqs.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN pip install --no-cache-dir -r dubbing_backend_reqs.txt | |
| COPY dubbing_backend/ ./dubbing_backend/ | |
| COPY pipeline/ ./pipeline/ | |
| COPY app.py ./ | |
| # Copy Frontend Build | |
| COPY --from=frontend-build /app/frontend/dist ./dist | |
| # Create workspace directory | |
| RUN mkdir -p workspace | |
| EXPOSE 7860 | |
| # Run uvicorn on port 7860 (required by HF) | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |