ethnmcl commited on
Commit
6182c59
·
verified ·
1 Parent(s): 2f012f6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -15
Dockerfile CHANGED
@@ -1,27 +1,27 @@
 
1
  FROM python:3.11-slim
2
 
3
- ENV PYTHONUNBUFFERED=1 \
 
 
4
  PIP_NO_CACHE_DIR=1 \
5
- HF_HOME=/data/huggingface
6
 
7
- # Create a writable, persistent cache directory in Spaces
8
- RUN mkdir -p /data/huggingface && chmod -R 777 /data
 
 
 
9
 
10
- # (Optional) system tools
11
- RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
12
 
13
  WORKDIR /app
14
  COPY requirements.txt /app/requirements.txt
 
15
 
16
- # Install CPU torch first (smaller, no CUDA), then the rest
17
- RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu torch==2.3.1+cpu \
18
- && pip install --no-cache-dir -r /app/requirements.txt
19
-
20
- COPY main.py /app/main.py
21
 
22
  EXPOSE 7860
23
- ENV MODEL_ID="ethnmcl/checkin-gpt2"
24
- # If the model repo is private, set a Space Secret named HF_TOKEN (Settings → Secrets)
25
-
26
- CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
27
 
 
1
+ # Dockerfile
2
  FROM python:3.11-slim
3
 
4
+ # Optional: speed up HF downloads & cache in container
5
+ ENV HF_HOME=/data/huggingface \
6
+ HF_HUB_ENABLE_HF_TRANSFER=1 \
7
  PIP_NO_CACHE_DIR=1 \
8
+ PYTHONUNBUFFERED=1
9
 
10
+ # -------- MODEL CONFIG --------
11
+ # Build-time overrideable default
12
+ ARG MODEL_ID=ethnmcl/checkin-lora-gpt2
13
+ # Runtime ENV (can still be overridden by deploy env)
14
+ ENV MODEL_ID=${MODEL_ID}
15
 
16
+ # Optional: if private model, pass HF_TOKEN at runtime only (not here)
17
+ # ENV HF_TOKEN=...
18
 
19
  WORKDIR /app
20
  COPY requirements.txt /app/requirements.txt
21
+ RUN pip install --upgrade pip && pip install -r requirements.txt
22
 
23
+ COPY . /app
 
 
 
 
24
 
25
  EXPOSE 7860
26
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
27