ProductShowcaseStudio / Dockerfile
sushilideaclan01's picture
.
7022787
Raw
History Blame Contribute Delete
909 Bytes
# syntax=docker/dockerfile:1
# Hugging Face Spaces (Docker) — FastAPI + Vite build. Listens on $PORT (default 7860).
FROM node:22-bookworm-slim AS frontend-build
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npm run build
FROM python:3.12-slim-bookworm
# git: HF Docker builder may inject `git config` after this file; slim images omit git by default.
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg git \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY backend/requirements.txt /app/backend/requirements.txt
RUN pip install --no-cache-dir -r /app/backend/requirements.txt
COPY backend/ /app/backend/
COPY --from=frontend-build /app/frontend/dist /app/frontend/dist
ENV PYTHONPATH=/app/backend
ENV PORT=7860
WORKDIR /app/backend
CMD ["sh", "-c", "exec uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]