dsmueller commited on
Commit
cae1910
·
1 Parent(s): 18b87a8

Update Dockerfile to use Python virtual environment for package installation

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -10,22 +10,23 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
10
 
11
  # Set up environment variables
12
  ENV HOME=/home/user \
13
- PATH=/home/user/.local/bin:$PATH \
14
- PATH=/home/user/.cargo/bin:$PATH
15
 
16
  # Set the working directory in the container
17
- # WORKDIR /usr/src/app
18
  WORKDIR $HOME/app
19
 
20
- # Copy the current directory contents into the container at /usr/src/app
21
- # COPY . /usr/src/app
22
  COPY --chown=user . $HOME/app
23
 
24
  # Set user to root
25
- # USER root
26
 
27
  # Install any needed packages specified in requirements.txt
28
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
 
29
 
30
  # Make port 80 available to the world outside this container
31
  EXPOSE 80
@@ -34,4 +35,5 @@ EXPOSE 80
34
  # ENV NAME World
35
 
36
  # Run train_llm.py when the container launches
37
- CMD ["python", "./train_llm.py"]
 
 
10
 
11
  # Set up environment variables
12
  ENV HOME=/home/user \
13
+ PATH=/home/user/.local/bin:/home/user/.cargo/bin:$PATH
 
14
 
15
  # Set the working directory in the container
 
16
  WORKDIR $HOME/app
17
 
18
+ # Copy the current directory contents into the container at /home/user/app
 
19
  COPY --chown=user . $HOME/app
20
 
21
  # Set user to root
22
+ USER root
23
 
24
  # Install any needed packages specified in requirements.txt
25
+ RUN python -m venv /venv && \
26
+ /venv/bin/pip install --no-cache-dir -r requirements.txt
27
+
28
+ # Set user back to non-root
29
+ USER user
30
 
31
  # Make port 80 available to the world outside this container
32
  EXPOSE 80
 
35
  # ENV NAME World
36
 
37
  # Run train_llm.py when the container launches
38
+ CMD ["/bin/bash", "-c", "source /venv/bin/activate && python train_llm.py"]
39
+ # CMD ["/venv/bin/python", "train_llm.py"]