jacky3102 commited on
Commit
8d1b5e0
·
verified ·
1 Parent(s): 2762d2f

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -11
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use Python 3.10 slim as base (smaller than full)
2
  FROM python:3.10-slim
3
 
4
  # Install system dependencies
@@ -6,30 +6,24 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
6
  git \
7
  && rm -rf /var/lib/apt/lists/*
8
 
9
- # Set working directory
10
  WORKDIR /app
11
 
12
- # Install CPU-only PyTorch first (from PyTorch CPU index)
13
  RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \
14
  torch==2.4.0 \
15
  torchvision==0.19.0 \
16
  torchaudio==2.4.0
17
 
18
- # Copy requirements and install Python dependencies
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir -r requirements.txt
21
 
22
- # Copy app code
23
  COPY app.py .
24
- COPY README.md .
25
 
26
- # Expose Gradio port
27
- EXPOSE 7860
28
-
29
- # Set environment variables
30
  ENV GRADIO_SERVER_NAME=0.0.0.0
31
  ENV GRADIO_SERVER_PORT=7860
32
  ENV PYTHONUNBUFFERED=1
33
 
34
- # Run the app
35
  CMD ["python", "app.py"]
 
1
+ # Use HF's recommended base for Gradio Spaces
2
  FROM python:3.10-slim
3
 
4
  # Install system dependencies
 
6
  git \
7
  && rm -rf /var/lib/apt/lists/*
8
 
 
9
  WORKDIR /app
10
 
11
+ # Install CPU PyTorch first
12
  RUN pip install --no-cache-dir --index-url https://download.pytorch.org/whl/cpu \
13
  torch==2.4.0 \
14
  torchvision==0.19.0 \
15
  torchaudio==2.4.0
16
 
17
+ # Copy and install requirements
18
  COPY requirements.txt .
19
  RUN pip install --no-cache-dir -r requirements.txt
20
 
21
+ # Copy app
22
  COPY app.py .
 
23
 
24
+ # HF expects the app to be at /app/app.py and will run it
 
 
 
25
  ENV GRADIO_SERVER_NAME=0.0.0.0
26
  ENV GRADIO_SERVER_PORT=7860
27
  ENV PYTHONUNBUFFERED=1
28
 
 
29
  CMD ["python", "app.py"]