SharathReddy commited on
Commit
0f5d34a
·
verified ·
1 Parent(s): a13b6ec

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -7
Dockerfile CHANGED
@@ -15,13 +15,19 @@ COPY ./mine_diffs.py .
15
  # 5. Install Python dependencies
16
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
- # 6. IMPORTANT: Create the subdirectory for clones and set permissions
19
- # This gives a new user with ID 1000 ownership of everything in /code
20
- RUN mkdir /code/repos && chown -R 1000:1000 /code
21
-
22
- # 7. Create and switch to the non-root user
23
- RUN useradd --uid 1000 --gid 1000 user
24
  USER user
25
 
26
- # 8. Set the command to automatically run the script
 
 
 
 
 
 
 
 
 
27
  CMD ["python", "mine_diffs.py"]
 
15
  # 5. Install Python dependencies
16
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
17
 
18
+ # 6. Create and switch to the non-root user
19
+ # This command creates the user AND their primary group
20
+ RUN useradd --create-home --uid 1000 user
 
 
 
21
  USER user
22
 
23
+ # 7. IMPORTANT: Re-set WORKDIR to the user's home and set permissions
24
+ # This ensures we are working in a directory the user owns
25
+ WORKDIR /home/user/code
26
+ RUN chown -R user:user /home/user
27
+
28
+ # 8. Copy files again to the new WORKDIR
29
+ COPY ./requirements.txt .
30
+ COPY ./mine_diffs.py .
31
+
32
+ # 9. Set the command to automatically run the script
33
  CMD ["python", "mine_diffs.py"]