# The frontend bundle is built in CI and uploaded alongside this file, so the # image is Python only and builds in seconds rather than pulling a Node # toolchain into the Space on every deploy. FROM python:3.11-slim ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ HOME=/home/user # Spaces run the container as uid 1000; writing as root leaves a $HOME the app # cannot use, which surfaces later as an opaque cache permission error. RUN useradd -m -u 1000 user WORKDIR /home/user/app COPY --chown=user requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY --chown=user server ./server COPY --chown=user static ./static USER user EXPOSE 7860 CMD ["uvicorn", "server.main:app", "--host", "0.0.0.0", "--port", "7860"]