Nausad commited on
Commit
cb11ea2
Β·
verified Β·
1 Parent(s): a0675a3

Delete Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +0 -58
Dockerfile DELETED
@@ -1,58 +0,0 @@
1
- # ─── Stage 1: Base Image ───────────────────────────────────────────────────
2
- FROM python:3.10-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # ─── Environment Variables ─────────────────────────────────────────────────
8
- # Prevent Python from writing .pyc files
9
- ENV PYTHONDONTWRITEBYTECODE=1
10
- # Prevent Python from buffering stdout/stderr
11
- ENV PYTHONUNBUFFERED=1
12
- # HuggingFace Spaces runs on port 7860
13
- ENV PORT=7860
14
-
15
- # ─── Create a non-root user FIRST (HuggingFace requirement) ────────────────
16
- RUN useradd -m -u 1000 appuser
17
-
18
- # ─── Install System Dependencies ───────────────────────────────────────────
19
- RUN apt-get update && apt-get install -y --no-install-recommends \
20
- libglib2.0-0 \
21
- libsm6 \
22
- libxrender1 \
23
- libxext6 \
24
- && apt-get clean \
25
- && rm -rf /var/lib/apt/lists/*
26
-
27
- # ─── Install Python Dependencies ───────────────────────────────────────────
28
- COPY requirements.txt .
29
-
30
- # Use CPU-only PyTorch index to keep image lean and avoid CUDA download timeouts
31
- RUN pip install --no-cache-dir \
32
- --extra-index-url https://download.pytorch.org/whl/cpu \
33
- -r requirements.txt
34
-
35
- # ─── Copy Application Files ────────────────────────────────────────────────
36
- COPY app.py .
37
- COPY cifar10_model.pth .
38
- COPY templates/ ./templates/
39
-
40
- # ─── Fix file ownership so appuser can read all files ──────────────────────
41
- RUN chown -R appuser:appuser /app
42
-
43
- # ─── Switch to non-root user ───────────────────────────────────────────────
44
- USER appuser
45
-
46
- # ─── Expose Port ───────────────────────────────────────────────────────────
47
- EXPOSE 7860
48
-
49
- # ─── Launch with Gunicorn (production WSGI server) ─────────────────────────
50
- # timeout=180 gives the model enough time to run inference on slow HF CPU
51
- # preload=true loads the model once before forking workers (saves memory)
52
- CMD ["gunicorn", \
53
- "--bind", "0.0.0.0:7860", \
54
- "--workers", "1", \
55
- "--timeout", "180", \
56
- "--preload", \
57
- "--log-level", "info", \
58
- "app:app"]