File size: 759 Bytes
2fe5c93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Code Evaluator — Hugging Face Spaces
#
# Requirements:
#   - Non-root user with UID 1000 (HF Spaces security policy)
#   - Application must listen on port 7860
#   - /home/user/.local/bin on PATH for pip-installed binaries

FROM python:3.11-slim

# Create the non-root user and /app in a single layer to minimise image size.
RUN useradd -m -u 1000 -s /bin/bash user \
    && mkdir -p /app \
    && chown user:user /app

WORKDIR /app

USER user

ENV PATH="/home/user/.local/bin:${PATH}"

# Copy deps first so Docker cache reuses this layer on source-only changes.
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY --chown=user . .

EXPOSE 7860

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]