Marek Bukowicki commited on
Commit
8ab058b
·
1 Parent(s): 64b4096

fix Docker permissions

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -4
Dockerfile CHANGED
@@ -1,12 +1,24 @@
1
- FROM python:3.10
2
 
3
- WORKDIR /usr/src/app
 
4
 
5
- COPY requirements-cpu.txt requirements-gui.txt ./
 
 
 
 
 
 
 
 
6
  RUN pip install --no-cache-dir -r requirements-cpu.txt -r requirements-gui.txt --extra-index-url https://download.pytorch.org/whl/cpu
7
 
8
- COPY . .
 
 
9
 
 
10
  RUN python download_files.py --overwrite
11
 
12
  CMD [ "python", "./predict-gui.py", "--server_name", "0.0.0.0" ]
 
1
+ FROM python:3.10 as build
2
 
3
+ RUN useradd -m -u 1000 user
4
+ USER user
5
 
6
+ # Set home to the user's home directory
7
+ ENV HOME=/home/user \
8
+ PATH=/home/user/.local/bin:$PATH
9
+
10
+ # Set the working directory to the user's home directory
11
+ WORKDIR $HOME/app
12
+
13
+
14
+ COPY --chown=user requirements-cpu.txt requirements-gui.txt ./
15
  RUN pip install --no-cache-dir -r requirements-cpu.txt -r requirements-gui.txt --extra-index-url https://download.pytorch.org/whl/cpu
16
 
17
+ FROM build as final
18
+
19
+ COPY --chown=user . .
20
 
21
+ # download weights
22
  RUN python download_files.py --overwrite
23
 
24
  CMD [ "python", "./predict-gui.py", "--server_name", "0.0.0.0" ]