Spaces:
Runtime error
Runtime error
Download Dockerfile from SuhasGholkar/testproj: direct link, hf CLI and curl.
- Browser
- Download file 1.66 kB
-
https://huggingface.co/spaces/SuhasGholkar/testproj/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/SuhasGholkar/testproj/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/SuhasGholkar/testproj/resolve/main/Dockerfile
1.66 kB
| # ---- Base image ---- | |
| FROM python:3.10-slim | |
| # ---- Workdir ---- | |
| WORKDIR /app | |
| # ---- Env ---- | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| STREAMLIT_SERVER_HEADLESS=true \ | |
| HF_HUB_DISABLE_SYMLINKS_WARNING=1 \ | |
| XDG_CACHE_HOME=/app/.cache | |
| # ---- Python deps ---- | |
| COPY requirements.txt /app/requirements.txt | |
| RUN python -m pip install --no-cache-dir --upgrade pip \ | |
| && python -m pip install --no-cache-dir -r /app/requirements.txt | |
| # System deps for video/text rendering | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| fonts-dejavu-core \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ---- App code ---- | |
| COPY . /app | |
| # ---- Create non-root user and fix permissions ---- | |
| # uid 1000 is conventional; adjust if you need | |
| RUN useradd -m -u 1000 -s /bin/sh app \ | |
| && mkdir -p /app/.streamlit /app/.cache \ | |
| && chown -R app:app /app | |
| # Drop privileges for runtime | |
| USER app | |
| # ---- Streamlit config ---- | |
| RUN printf "[server]\nheadless = true\nport = 7860\naddress = \"0.0.0.0\"\nenableCORS = false\nenableXsrfProtection = false\n" \ | |
| > /app/.streamlit/config.toml | |
| # ---- Port & health ---- | |
| EXPOSE 7860 | |
| ENV PORT=7860 | |
| # Healthcheck hits Streamlit's built-in health endpoint | |
| COPY --chown=app:app healthcheck.py /app/healthcheck.py | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=5 \ | |
| CMD python /app/healthcheck.py || exit 1 | |
| # ---- Start the app ---- | |
| # Use sh -c so ${PORT} expands at runtime on Spaces | |
| CMD ["sh","-c","python -m streamlit run app.py --server.port=${PORT:-7860} --server.address=0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false"] | |