Spaces:
Paused
Paused
| ARG BUILDPLATFORM | |
| ARG TARGETPLATFORM | |
| ARG TARGETARCH | |
| FROM --platform=$BUILDPLATFORM node:22-alpine AS web-build | |
| WORKDIR /app/web | |
| COPY web/package.json web/bun.lock ./ | |
| RUN npm install | |
| COPY VERSION /app/VERSION | |
| COPY web ./ | |
| RUN NEXT_PUBLIC_APP_VERSION="$(cat /app/VERSION)" npm run build | |
| FROM --platform=$TARGETPLATFORM python:3.13-slim AS app | |
| ARG TARGETPLATFORM | |
| ARG TARGETARCH | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| UV_LINK_MODE=copy \ | |
| HOME=/app \ | |
| BLOCKING_THREADPOOL_SIZE=128 | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| git \ | |
| libpq-dev \ | |
| gcc \ | |
| openssl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| RUN pip install --no-cache-dir uv | |
| COPY pyproject.toml uv.lock ./ | |
| RUN uv sync --frozen --no-dev --no-install-project | |
| COPY main.py ./ | |
| COPY config.json ./ | |
| COPY VERSION ./ | |
| COPY api ./api | |
| COPY services ./services | |
| COPY utils ./utils | |
| COPY scripts ./scripts | |
| COPY --from=web-build /app/web/out ./web_dist | |
| RUN mkdir -p /app/data && chmod -R 777 /app | |
| EXPOSE 7860 | |
| # --frozen/--no-dev keep `uv run` fully offline at container start: without them uv | |
| # re-resolves the lockfile against the network on every cold boot, which wedges on | |
| # HF's flaky egress and leaves the app stuck in APP_STARTING (no uvicorn ever binds). | |
| CMD ["uv", "run", "--frozen", "--no-dev", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--access-log"] | |