userIdc2024's picture
Update Dockerfile
ec7da2a verified
raw
history blame
942 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install build tools and curl
RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# --- ADD THIS TO FIX PERMISSION ISSUE ---
# Set environment variables to redirect Streamlit config/cache
ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
ENV STREAMLIT_CACHE_DIR=/app/.streamlit/cache
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
# Create directory explicitly
RUN mkdir -p /app/.streamlit /app/.streamlit/cache
# Copy files
COPY requirements.txt ./
COPY src/ ./src/
# Install Python deps
RUN pip install --no-cache-dir -r requirements.txt
# Streamlit port
EXPOSE 8501
# Healthcheck for Hugging Face
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
# Run the Streamlit app
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]