Spaces:
Runtime error
Runtime error
File size: 1,185 Bytes
6cc3d86 71c5ff9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | # syntax=docker/dockerfile:1
# Hugging Face Spaces: sdk: docker, default port 7860 (override with PORT).
# Build from repo root (directory that contains web/ and assets/).
FROM node:20-bookworm-slim AS frontend-build
WORKDIR /app/web/frontend
COPY web/frontend/package.json web/frontend/package-lock.json ./
RUN npm ci
COPY web/frontend/ ./
RUN npm run build
FROM python:3.12-slim-bookworm
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app
RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg \
&& rm -rf /var/lib/apt/lists/*
COPY web/requirements.txt /app/web/requirements.txt
RUN pip install --no-cache-dir -r /app/web/requirements.txt
COPY web /app/web
COPY assets /app/assets
COPY --from=frontend-build /app/web/backend/static /app/web/backend/static
EXPOSE 7860
# Trust reverse-proxy headers (X-Forwarded-Proto). Default allow-list is 127.0.0.1 only;
# HF Spaces sits behind a proxy — without this, the app thinks the request is HTTP and
# session cookies often fail, so login loops.
CMD ["sh", "-c", "exec uvicorn web.backend.main:app --host 0.0.0.0 --port ${PORT:-7860} --forwarded-allow-ips='*'"]
|