Spaces:
Sleeping
Sleeping
File size: 1,192 Bytes
12844b2 c7dec45 f2916f4 6972bfe cd828e6 c7dec45 cd828e6 c7dec45 cd828e6 6972bfe c7dec45 6972bfe cd828e6 6972bfe f2916f4 cd828e6 c7dec45 cd828e6 36ce38b |
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 40 41 42 43 44 |
FROM python:3.12-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
HOME=/app \
# π force writable paths on HF Spaces
UPLOAD_DIR=/data/uploads \
TMPDIR=/data/tmp
WORKDIR /app
# System deps (lean)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl git \
&& rm -rf /var/lib/apt/lists/*
# Leverage layer cache
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# App source
COPY src/ ./src/
# Streamlit config dir (lives in image layer, ok)
RUN mkdir -p /app/.streamlit
# β
Create writable persistent dirs and grant permissions
# /data is the only writable volume on Hugging Face Spaces.
RUN mkdir -p /data/uploads /data/tmp \
&& chmod -R 777 /data
# (Optional) non-root β if you uncomment, make sure /data is owned or world-writable
# RUN useradd -m -d /app appuser && chown -R appuser:appuser /app /data
# USER appuser
EXPOSE 8501
# Healthcheck
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py"] |