Hebrew
meirk commited on
Commit
d3f8264
·
verified ·
1 Parent(s): 4604f0d

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -13
Dockerfile CHANGED
@@ -1,21 +1,19 @@
1
- # Use an official NVIDIA base image with PyTorch, CUDA, and cuDNN pre-installed
2
- # We choose a version with Python 3.11 to match your previous environment
3
  FROM nvcr.io/nvidia/pytorch:24.04-py3
4
 
5
- # Set the working directory
6
  WORKDIR /repository
7
 
8
- # Copy the requirements file into the container
9
- COPY requirements.txt .
 
10
 
11
- # Install your Python dependencies
12
- # Using --no-cache-dir is good practice for smaller image sizes
13
- RUN pip install --no-cache-dir -r requirements.txt
14
 
15
- # Copy the rest of your application code (e.g., your handler.py)
16
  COPY . .
17
 
18
- # (Optional) Set an environment variable if needed by your platform
19
- # ENV TRANSFORMERS_CACHE="/repository/cache"
20
-
21
- # Your inference platform will typically handle the CMD or ENTRYPOINT
 
1
+ # 1. Start from the same great NVIDIA base image
 
2
  FROM nvcr.io/nvidia/pytorch:24.04-py3
3
 
4
+ # 2. Set the working directory
5
  WORKDIR /repository
6
 
7
+ # 3. Add Hugging Face specific environment variables
8
+ ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
9
+ ENV PORT=80
10
 
11
+ # 4. Copy and install requirements AND the HF toolkit
12
+ COPY requirements.txt .
13
+ RUN pip install --no-cache-dir -r requirements.txt huggingface_inference_toolkit
14
 
15
+ # 5. Copy the rest of your application code
16
  COPY . .
17
 
18
+ # 6. THE CRUCIAL PART: Set the command to run the inference server
19
+ CMD ["python", "-m", "huggingface_inference_toolkit.main", "--model_dir", "."]