ygauravyy commited on
Commit
29c746e
1 Parent(s): c9af526

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -3
Dockerfile CHANGED
@@ -5,17 +5,24 @@ FROM continuumio/miniconda3:24.1.2-0
5
  USER root
6
  WORKDIR /app
7
 
8
- # Copy all repository files into the image
9
  COPY . /app
10
 
11
- # Run the torchserve setup script that replicates the steps from the original torchserve Dockerfile
12
  RUN chmod +x /app/torchserve_setup.sh && /app/torchserve_setup.sh
13
 
14
  # Install your package in editable mode
15
  RUN pip install -e .
16
 
 
 
 
 
 
 
 
17
  # Expose port 7860 for Gradio on Hugging Face Spaces
18
  EXPOSE 7860
19
 
20
- # Run the Gradio app
21
  CMD ["python", "app.py"]
 
5
  USER root
6
  WORKDIR /app
7
 
8
+ # Copy all repo files into /app
9
  COPY . /app
10
 
11
+ # Run the torchserve setup script that replicates steps from the original torchserve/Dockerfile
12
  RUN chmod +x /app/torchserve_setup.sh && /app/torchserve_setup.sh
13
 
14
  # Install your package in editable mode
15
  RUN pip install -e .
16
 
17
+ # IMPORTANT: Change ownership of /app to the non-root user (with UID 1000)
18
+ # Hugging Face Spaces runs the container as a non-root user with UID 1000 by default.
19
+ RUN chown -R 1000:1000 /app
20
+
21
+ # Switch to the non-root user
22
+ USER 1000
23
+
24
  # Expose port 7860 for Gradio on Hugging Face Spaces
25
  EXPOSE 7860
26
 
27
+ # Run the Gradio app as the non-root user now that it has proper permissions
28
  CMD ["python", "app.py"]