nanfangwuyu21 commited on
Commit
af65ba0
·
1 Parent(s): 263096c

Update dockerfile, added a user for permission

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -5
Dockerfile CHANGED
@@ -1,5 +1,5 @@
1
  ### For CPU
2
- # FROM python:3.10-slim
3
 
4
  # RUN apt-get update && apt-get install -y git curl libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*
5
 
@@ -13,13 +13,24 @@
13
 
14
  ### For GPU
15
 
16
- FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
17
 
18
- RUN apt-get update && apt-get install -y python3.10 python3-pip git curl
19
 
 
 
20
 
21
- WORKDIR /
22
- COPY . /
 
 
 
 
 
 
 
 
 
23
 
24
  RUN chmod +x scripts/start.sh
25
 
 
1
  ### For CPU
2
+ FROM python:3.10-slim
3
 
4
  # RUN apt-get update && apt-get install -y git curl libgl1-mesa-glx && rm -rf /var/lib/apt/lists/*
5
 
 
13
 
14
  ### For GPU
15
 
16
+ # FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
17
 
18
+ # RUN apt-get update && apt-get install -y python3.10 python3-pip git curl
19
 
20
+ # Set up a new user named "user" with user ID 1000
21
+ RUN useradd -m -u 1000 user
22
 
23
+ # Switch to the "user" user
24
+ USER user
25
+
26
+ # Set home to the user's home directory
27
+ ENV HOME=/home/user \
28
+ PATH=/home/user/.local/bin:$PATH
29
+
30
+ WORKDIR $HOME/app
31
+ RUN pip install --no-cache-dir --upgrade pip
32
+
33
+ COPY --chown=user . $HOME/app
34
 
35
  RUN chmod +x scripts/start.sh
36