developer-lunark commited on
Commit
0b6aecc
·
verified ·
1 Parent(s): 3d924e1

Update Dockerfile for GPU inference

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -1
Dockerfile CHANGED
@@ -1,10 +1,11 @@
1
- FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
 
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
  # Copy requirements and install
@@ -14,6 +15,13 @@ RUN pip install --no-cache-dir -r requirements.txt
14
  # Copy app
15
  COPY . .
16
 
 
 
 
 
 
 
 
17
  # Expose port
18
  EXPOSE 7860
19
 
 
1
+ FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime
2
 
3
  WORKDIR /app
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
+ git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  # Copy requirements and install
 
15
  # Copy app
16
  COPY . .
17
 
18
+ # Create user for HF Space
19
+ RUN useradd -m -u 1000 user
20
+ USER user
21
+
22
+ # Set HF cache directory
23
+ ENV HF_HOME=/tmp/huggingface
24
+
25
  # Expose port
26
  EXPOSE 7860
27