Spaces:
Running
Running
FROM python:3.9-slim | |
# Optional: speed up pip & keep image small | |
ENV PIP_NO_CACHE_DIR=1 \ | |
PIP_DISABLE_PIP_VERSION_CHECK=1 \ | |
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false | |
WORKDIR /app | |
# Minimal, Debian-safe packages (no software-properties-common on Debian) | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ | |
curl \ | |
ca-certificates \ | |
&& rm -rf /var/lib/apt/lists/* | |
# If you use OpenCV or video/image I/O at runtime, uncomment these: | |
# RUN apt-get update && apt-get install -y --no-install-recommends \ | |
# ffmpeg libsm6 libxext6 libgl1 \ | |
# && rm -rf /var/lib/apt/lists/* | |
# Install deps first for better Docker layer caching | |
COPY requirements.txt ./ | |
RUN pip install -r requirements.txt | |
# App code | |
COPY src/ ./src/ | |
# Expose is informational; HF Spaces sets $PORT | |
EXPOSE 8501 | |
# Streamlit health endpoint (optional on HF; keep curl installed) | |
HEALTHCHECK CMD curl --fail http://localhost:${PORT:-8501}/_stcore/health || exit 1 | |
# Use a shell form so $PORT expands correctly on HF Spaces | |
CMD ["bash", "-lc", "streamlit run src/streamlit_app.py --server.port=${PORT:-8501} --server.address=0.0.0.0"] | |