sammyview80 commited on
Commit
e56878c
1 Parent(s): d54be73

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -7
Dockerfile CHANGED
@@ -1,16 +1,31 @@
1
- # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
- FROM python:3.9
 
 
5
 
6
- WORKDIR /code
 
7
 
8
- COPY ./requirements.txt /code/requirements.txt
 
 
9
 
10
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
 
 
 
 
 
 
 
11
 
12
  COPY . .
13
 
14
- COPY --chown=user . $HOME/code
 
 
 
15
 
16
  CMD ["gunicorn", "-b", "0.0.0.0:7860", "flask_app:app"]
 
1
+ FROM python:3.10-slim-buster
 
2
 
3
+ ### Set up user with permissions
4
+ # Set up a new user named "user" with user ID 1000
5
+ RUN useradd -m -u 1000 user
6
 
7
+ # Switch to the "user" user
8
+ USER user
9
 
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH
13
 
14
+ # Set the working directory to the user's home directory
15
+ WORKDIR $HOME/app
16
+
17
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
18
+ COPY --chown=user . $HOME/app
19
+
20
+ ### Set up app-specific content
21
+ COPY requirements.txt requirements.txt
22
+ RUN pip3 install -r requirements.txt
23
 
24
  COPY . .
25
 
26
+ ### Update permissions for the app
27
+ USER root
28
+ RUN chmod 777 ~/app/*
29
+ USER user
30
 
31
  CMD ["gunicorn", "-b", "0.0.0.0:7860", "flask_app:app"]