Amrender commited on
Commit
2f9524f
·
verified ·
1 Parent(s): 9d717de

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +28 -0
Dockerfile ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official PyTorch image with CUDA support
2
+ FROM pytorch/pytorch:2.2.1-cuda12.1-cudnn8-runtime
3
+
4
+ # Hugging Face Spaces require running as a non-root user with ID 1000
5
+ RUN useradd -m -u 1000 user
6
+ USER user
7
+
8
+ # Set environment variables
9
+ ENV HOME=/home/user \
10
+ PATH=/home/user/.local/bin:$PATH \
11
+ PYTHONUNBUFFERED=1
12
+
13
+ # Set the working directory
14
+ WORKDIR $HOME/app
15
+
16
+ # Copy requirements and install them
17
+ COPY --chown=user requirements.txt .
18
+ RUN pip install --no-cache-dir --upgrade pip && \
19
+ pip install --no-cache-dir -r requirements.txt
20
+
21
+ # Copy the rest of the app files
22
+ COPY --chown=user . .
23
+
24
+ # Expose the standard Gradio port
25
+ EXPOSE 7860
26
+
27
+ # Run the Gradio app
28
+ CMD ["python", "app.py"]