srishtichugh commited on
Commit
d0dc091
·
1 Parent(s): 9378dc6

Fix Dockerfile for HF Spaces deployment

Browse files
Files changed (2) hide show
  1. Dockerfile +11 -40
  2. requirements.txt +1 -9
Dockerfile CHANGED
@@ -1,49 +1,20 @@
1
- FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
2
 
3
- WORKDIR /app
4
 
5
- # System deps
6
- RUN apt-get update && apt-get install -y \
7
- python3 python3-pip git && \
8
- rm -rf /var/lib/apt/lists/*
9
 
10
- # Python setup
11
- RUN pip3 install --upgrade pip
12
 
13
- # Copy files
14
- COPY . /app
15
 
16
- # Install Python deps
17
- RUN pip install -r requirements.txt
18
 
19
- # Expose port for env server
20
  EXPOSE 8000
21
 
22
- # Run training
23
- CMD ["python3", "train.py"]
24
- # FROM python:3.11-slim
25
-
26
- # # Non-root user for HuggingFace Spaces compatibility
27
- # RUN useradd -m -u 1000 appuser
28
-
29
- # WORKDIR /app
30
-
31
- # # Install dependencies first (layer cache)
32
- # COPY requirements.txt .
33
- # RUN pip install --no-cache-dir -r requirements.txt
34
-
35
- # # Copy project files
36
- # COPY . .
37
-
38
- # # Switch to non-root
39
- # RUN chown -R appuser:appuser /app
40
- # USER appuser
41
-
42
- # EXPOSE 8000
43
-
44
- # HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
45
- # CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
46
 
47
- # # server.app:app runs server/app.py from /app working directory
48
- # # models.py, client.py, inference.py live at /app root (on PYTHONPATH automatically)
49
- # CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ FROM python:3.11-slim
2
 
3
+ RUN useradd -m -u 1000 appuser
4
 
5
+ WORKDIR /app
 
 
 
6
 
7
+ COPY requirements.txt .
8
+ RUN pip install --no-cache-dir -r requirements.txt
9
 
10
+ COPY . .
 
11
 
12
+ RUN chown -R appuser:appuser /app
13
+ USER appuser
14
 
 
15
  EXPOSE 8000
16
 
17
+ HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
18
+ CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
20
+ CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
requirements.txt CHANGED
@@ -8,12 +8,4 @@ openai==2.15.0
8
  httpx==0.28.1
9
  openenv-core==0.2.3
10
  aiofiles>=23.0.0
11
- torch
12
- transformers
13
- datasets
14
- trl
15
- unsloth
16
- matplotlib
17
- numpy
18
- accelerate
19
- bitsandbytes
 
8
  httpx==0.28.1
9
  openenv-core==0.2.3
10
  aiofiles>=23.0.0
11
+ python-dotenv>=1.0.0