Spaces:
Runtime error
Runtime error
Download Dockerfile from pnstack/template-python: direct link, hf CLI and curl.
- Browser
- Download file 885 Bytes
-
https://huggingface.co/spaces/pnstack/template-python/resolve/eee346ea36e7cbec55dd22c9cfed2b7dc55fd4fc/Dockerfile
- Command line
-
hf download hf://spaces/pnstack/template-python@eee346ea36e7cbec55dd22c9cfed2b7dc55fd4fc/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/pnstack/template-python/resolve/eee346ea36e7cbec55dd22c9cfed2b7dc55fd4fc/Dockerfile
885 Bytes
| FROM python:3.11-slim AS base | |
| # Set Python environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONFAULTHANDLER=1 \ | |
| LANG=C.UTF-8 \ | |
| LC_ALL=C.UTF-8 | |
| # Install basic dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Upgrade pip | |
| RUN pip install --no-cache-dir --upgrade pip | |
| FROM base AS builder | |
| # Create and activate virtual environment | |
| RUN python -m venv /.venv | |
| ENV PATH="/.venv/bin:$PATH" | |
| # Install dependencies | |
| COPY pyproject.toml . | |
| RUN pip install --no-cache-dir . | |
| FROM base as runtime | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy virtual environment from builder | |
| COPY --from=builder /.venv /.venv | |
| ENV PATH="/.venv/bin:$PATH" | |
| # Copy application code | |
| COPY . . | |
| # Expose port (adjust if needed) | |
| EXPOSE 8000 | |
| # Run the application | |
| CMD ["python", "main.py"] |