yaziciz commited on
Commit
7bd5eaa
·
verified ·
1 Parent(s): 30aa463

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -10
Dockerfile CHANGED
@@ -1,27 +1,32 @@
1
  FROM yaziciz/deepsurg_vllm_v1
2
 
 
3
  RUN apt-get update && apt-get install -y libgl1-mesa-glx
4
 
 
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
- # Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
18
- RUN pip install --no-cache-dir --upgrade pip
19
 
20
- # Create the conda environment using the absolute path to the environment file.
21
- RUN conda env create -f environment.yml
22
 
23
- # (Optional) Debug: List files in $HOME/app to verify environment.yml is present.
24
- RUN ls -la /
25
 
26
  # Run demo.py using the 'ssgqa' conda environment.
27
  CMD ["conda", "run", "--no-capture-output", "-n", "ssgqa", "python", "demo.py"]
 
1
  FROM yaziciz/deepsurg_vllm_v1
2
 
3
+ # Install system dependency required for OpenCV.
4
  RUN apt-get update && apt-get install -y libgl1-mesa-glx
5
 
6
+ # Create a new user.
7
  RUN useradd -m -u 1000 user
8
 
9
+ # Create the destination directory, move all files from /app (from the base image) to /home/user/app, and update ownership recursively.
10
+ RUN mkdir -p /home/user/app && \
11
+ cp -r /app/* /home/user/app/ && \
12
+ chown -R user:user /home/user/app
13
+
14
+ # Switch to the non-root user.
15
  USER user
16
 
 
17
  ENV HOME=/home/user \
18
+ PATH=/home/user/.local/bin:$PATH
19
 
 
20
  WORKDIR $HOME/app
21
 
22
+ # Copy all additional files from the build context to $HOME/app recursively with correct ownership.
23
+ COPY --chown=user . $HOME/app
24
 
25
+ # (Optional) Debug: List all files to verify they are in place.
26
+ RUN ls -laR $HOME/app
27
 
28
+ # Create the conda environment using the environment file located at $HOME/app/environment.yml.
29
+ RUN conda env create -f $HOME/app/environment.yml
30
 
31
  # Run demo.py using the 'ssgqa' conda environment.
32
  CMD ["conda", "run", "--no-capture-output", "-n", "ssgqa", "python", "demo.py"]