Download Dockerfile from Nausad/Vision_Transformer_Based_Image_Classification_Model: direct link, hf CLI and curl.
- Browser
- Download file 2.15 kB
-
https://huggingface.co/spaces/Nausad/Vision_Transformer_Based_Image_Classification_Model/resolve/cb91c228e10d02172fba0eadfc2016080b1f7f12/Dockerfile
- Command line
-
hf download hf://spaces/Nausad/Vision_Transformer_Based_Image_Classification_Model@cb91c228e10d02172fba0eadfc2016080b1f7f12/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Nausad/Vision_Transformer_Based_Image_Classification_Model/resolve/cb91c228e10d02172fba0eadfc2016080b1f7f12/Dockerfile
2.15 kB
| # βββ Stage 1: Base Image βββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # βββ Environment Variables βββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Prevent Python from writing .pyc files | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| # Prevent Python from buffering stdout/stderr | |
| ENV PYTHONUNBUFFERED=1 | |
| # HuggingFace Spaces runs on port 7860 | |
| ENV PORT=7860 | |
| # βββ Install System Dependencies βββββββββββββββββββββββββββββββββββββββββββ | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxrender1 \ | |
| libxext6 \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # βββ Install Python Dependencies βββββββββββββββββββββββββββββββββββββββββββ | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # βββ Copy Application Files ββββββββββββββββββββββββββββββββββββββββββββββββ | |
| COPY app.py . | |
| COPY cifar10_model.pth . | |
| COPY templates/ ./templates/ | |
| # βββ Create a non-root user (HuggingFace best practice) ββββββββββββββββββββ | |
| RUN useradd -m -u 1000 appuser | |
| USER appuser | |
| # βββ Expose Port βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| EXPOSE 7860 | |
| # βββ Launch with Gunicorn (production WSGI server) βββββββββββββββββββββββββ | |
| CMD ["gunicorn", \ | |
| "--bind", "0.0.0.0:7860", \ | |
| "--workers", "1", \ | |
| "--timeout", "120", \ | |
| "--log-level", "info", \ | |
| "app:app"] | |