Marek Bukowicki commited on
Commit
d5aa806
·
1 Parent(s): e76ef19

fix Docker permissions

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -5
Dockerfile CHANGED
@@ -1,13 +1,25 @@
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" ]
13
 
 
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"]
25