Spaces:
No application file
No application file
File size: 1,122 Bytes
5afeb22 3d2e8fc 5afeb22 3d2e8fc 5afeb22 3d2e8fc | 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 31 32 33 34 35 36 37 38 39 | # Use a stable, lightweight Python base
FROM python:3.11-slim
# Set environment variables to ensure output is sent to logs immediately
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1
# Set the working directory
WORKDIR /app
# Install only essential system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user (Hugging Face standard UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set up the app directory with correct permissions
WORKDIR WORKDIR /home/user/app
COPY --chown=user . .
RUN pip install --user -r requirements.txt
# Copy the rest of the application
COPY --chown=user . .
# Hugging Face Spaces specific port
EXPOSE 7860
# Command to run Streamlit correctly
# --server.address=0.0.0.0 is mandatory for cloud access
# --server.enableXsrfProtection=false is required for the HF iFrame
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"] |