Space78 / Dockerfile
Entreprenerdly's picture
Update Dockerfile
ec948b3 verified
raw
history blame contribute delete
869 Bytes
FROM python:3.9-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
WORKDIR /app
# system deps (keep minimal; drop build-essential if not building wheels)
RUN apt-get update && apt-get install -y --no-install-recommends \
curl git ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# python deps (better cache behavior)
COPY requirements.txt .
RUN python -m pip install --upgrade pip \
&& pip install --no-cache-dir --prefer-binary -r requirements.txt
# your code
COPY . .
ENV PORT=7860
EXPOSE 7860
# healthcheck helps detect boot issues
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD curl --fail http://127.0.0.1:${PORT}/_stcore/health || exit 1
CMD ["sh", "-c", "streamlit run app.py --server.address=0.0.0.0 --server.port=${PORT}"]