AdhyanshVerma commited on
Commit
37b863d
·
verified ·
1 Parent(s): f359a91

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -8
Dockerfile CHANGED
@@ -1,14 +1,26 @@
1
- FROM python:3.11-slim
2
 
3
- # HF Spaces runs as a non-root user; make sure /tmp is writable (it always is)
4
- WORKDIR /app
5
 
6
- COPY requirements.txt .
7
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
 
 
 
8
 
9
- COPY main.py .
 
 
 
 
10
 
11
- # HF Spaces expects the app on port 7860
12
  EXPOSE 7860
13
 
14
- CMD ["python", "main.py"]
 
 
1
+ FROM python:3.10-slim
2
 
3
+ # Set up a new user named "user" with user ID 1000
4
+ RUN useradd -m -u 1000 user
5
 
6
+ # Switch to the "user" user
7
+ USER user
8
+
9
+ # Set home to the user's home directory
10
+ ENV HOME=/home/user \
11
+ PATH=/home/user/.local/bin:$PATH
12
+
13
+ # Set the working directory to the user's home directory
14
+ WORKDIR $HOME/app
15
 
16
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
17
+ COPY --chown=user . $HOME/app
18
+
19
+ # Install dependencies
20
+ RUN pip install --no-cache-dir -r requirements.txt
21
 
22
+ # Expose the port
23
  EXPOSE 7860
24
 
25
+ # Command to run on start
26
+ CMD ["python", "app.py"]