Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +1 -15
Dockerfile
CHANGED
|
@@ -1,39 +1,25 @@
|
|
| 1 |
-
|
| 2 |
-
# Use the same base as before
|
| 3 |
FROM python:3.10-slim
|
| 4 |
|
| 5 |
-
# Create a non-root user matching HF Spaces runtime (UID 1000)
|
| 6 |
RUN useradd -m -u 1000 user
|
| 7 |
|
| 8 |
-
# Switch to the non-root user
|
| 9 |
USER user
|
| 10 |
|
| 11 |
-
# Set HOME and PATH for the user
|
| 12 |
ENV HOME=/home/user \
|
| 13 |
PATH=/home/user/.local/bin:$PATH
|
| 14 |
|
| 15 |
-
# Set working directory under HOME
|
| 16 |
WORKDIR $HOME/app
|
| 17 |
|
| 18 |
-
# (Optional) system deps if you need them; safe to remove if not needed
|
| 19 |
-
# Note: Run as root if needed, but here it's fine as user since no installs yet
|
| 20 |
USER root
|
| 21 |
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
| 22 |
USER user
|
| 23 |
|
| 24 |
-
# Install Python deps as the user
|
| 25 |
COPY --chown=user requirements.txt $HOME/app/
|
| 26 |
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
| 27 |
|
| 28 |
-
# Copy code with correct ownership
|
| 29 |
COPY --chown=user . $HOME/app/
|
| 30 |
|
| 31 |
-
# Create .streamlit config to disable usage stats (prevents the write attempt causing permission errors)
|
| 32 |
RUN mkdir -p $HOME/.streamlit \
|
| 33 |
&& echo "[browser]\ngatherUsageStats = false" > $HOME/.streamlit/config.toml
|
| 34 |
|
| 35 |
-
# Do NOT set STREAMLIT_SERVER_PORT here.
|
| 36 |
-
# Spaces will inject $PORT at runtime.
|
| 37 |
-
|
| 38 |
-
# Start Streamlit on the port Spaces provides, and bind to 0.0.0.0
|
| 39 |
CMD ["streamlit", "run", "frontend.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
|
|
|
|
| 1 |
+
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
|
|
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
|
|
|
|
| 6 |
USER user
|
| 7 |
|
|
|
|
| 8 |
ENV HOME=/home/user \
|
| 9 |
PATH=/home/user/.local/bin:$PATH
|
| 10 |
|
|
|
|
| 11 |
WORKDIR $HOME/app
|
| 12 |
|
|
|
|
|
|
|
| 13 |
USER root
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*
|
| 15 |
USER user
|
| 16 |
|
|
|
|
| 17 |
COPY --chown=user requirements.txt $HOME/app/
|
| 18 |
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
| 19 |
|
|
|
|
| 20 |
COPY --chown=user . $HOME/app/
|
| 21 |
|
|
|
|
| 22 |
RUN mkdir -p $HOME/.streamlit \
|
| 23 |
&& echo "[browser]\ngatherUsageStats = false" > $HOME/.streamlit/config.toml
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
CMD ["streamlit", "run", "frontend.py", "--server.port", "8501", "--server.address", "0.0.0.0"]
|