-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
26 lines (19 loc) · 777 Bytes
/
Copy pathDockerfile
File metadata and controls
26 lines (19 loc) · 777 Bytes
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
FROM python:3.11-slim
# Install system dependencies if any are needed
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /lib/apt/lists/*
WORKDIR /app
# 1. Copy and install requirements as ROOT first (Fixes the writeable error)
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# 2. Now create the secure, unprivileged user for Hugging Face Spaces compliance
RUN useradd -m -u 1000 user && chown -R user:user /app
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# 3. Copy the rest of your app code
COPY --chown=user . .
EXPOSE 7860
CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]