Spaces:
Running
Running
File size: 1,621 Bytes
3d968d9 | 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 38 39 40 | # NOT used by the Hugging Face Space.
#
# The Space is `sdk: static` (see README.md's front matter), because creating a
# Docker Space requires a paid Hugging Face plan. This file exists for two
# reasons:
#
# 1. running upstream unmodified in a container locally, where app.py serves
# the real API and the browser overlay is not involved at all;
# 2. as the starting point if this ever moves to a paid plan.
#
# Read the caveat before reaching for reason 2: a Space's filesystem is
# ephemeral. Upstream stores documents in uploads/ and review records in
# data/reviews.json, so a restarted container starts empty. Making the Space a
# real review system needs a persistent volume or an external store, not just
# this Dockerfile.
#
# Upstream needs no third-party packages, so there is nothing to install.
FROM python:3.13-slim
# Hugging Face Spaces run as uid 1000 and expect the app on port 7860.
RUN useradd --create-home --uid 1000 app
USER app
WORKDIR /home/app
# The vendored upstream mirror, exactly as sync-upstream.ps1 left it. Nothing
# from overlay/ is copied: in a container the real server answers /api/, and the
# browser-side reimplementation would be a second, conflicting answer.
COPY --chown=app:app app/ ./
# Written at runtime by app.py's ensure_storage(), and ephemeral in a Space.
RUN mkdir -p data uploads
EXPOSE 7860
# app.py's run() defaults to 127.0.0.1:4173, which is unreachable from outside a
# container, so host and port are passed explicitly. sync-upstream.ps1 warns if
# upstream ever changes that signature.
CMD ["python", "-c", "import app; app.run('0.0.0.0', 7860)"]
|