Abs6187's picture
Update Dockerfile
b1cb267 verified
raw
history blame
1.16 kB
FROM python:3.13.5-slim
WORKDIR /app
# Install OS-level dependencies if your app needs them (e.g. building wheels, git, curl)
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency spec and source code
COPY requirements.txt ./
COPY src/ ./src/
# Install Python dependencies
RUN pip3 install --no-cache-dir -r requirements.txt
# (Optional) Set environment variables useful in HF Spaces / container environment
# Avoid Streamlit trying to write to root directories it might not have permission to.
ENV STREAMLIT_HOME=/tmp/.streamlit
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# Expose the port used by Streamlit in HF (8501)
EXPOSE 8501
# Healthcheck: test whether Streamlit's health endpoint is alive
# But note: there are known issues with Streamlit health endpoint in some environments. :contentReference[oaicite:2]{index=2}
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# Launch Streamlit app; bind to 0.0.0.0 so external connections work
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]