File size: 752 Bytes
17b22d9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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"]