tuan243 commited on
Commit
46c29f0
·
verified ·
1 Parent(s): 2e6b95a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -11
Dockerfile CHANGED
@@ -5,30 +5,29 @@ RUN pwd && ls -l
5
  # Create a user with UID 1000
6
  RUN useradd -m -u 1000 user
7
 
 
 
 
8
  # Set the working directory and user environment variables
9
- ENV HOME=/home/user \
10
- PATH=/home/user/.local/bin:$PATH
11
 
12
  # Switch to the user's home directory
13
- WORKDIR $HOME
14
 
15
  # Copy the application files into the user's home directory
16
- COPY --chown=user:user . $HOME
17
 
18
  # Copy the requirements file to the /code directory
19
  COPY ./requirements.txt /code/requirements.txt
20
 
21
  # Install the Python dependencies
22
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
23
 
24
- # Create a directory for cache and set permissions
25
- RUN mkdir -p $HOME/.cache && chmod 777 $HOME/.cache
26
-
27
- # Switch back to the user
28
- USER user
29
 
30
  # Set the working directory for the application
31
- WORKDIR $HOME
32
 
33
  RUN pwd && ls -l
34
 
 
5
  # Create a user with UID 1000
6
  RUN useradd -m -u 1000 user
7
 
8
+ # Switch to the user
9
+ USER user
10
+
11
  # Set the working directory and user environment variables
12
+ ENV PATH=/home/user/.local/bin:$PATH
 
13
 
14
  # Switch to the user's home directory
15
+ WORKDIR /home/user
16
 
17
  # Copy the application files into the user's home directory
18
+ COPY --chown=user:user . /home/user
19
 
20
  # Copy the requirements file to the /code directory
21
  COPY ./requirements.txt /code/requirements.txt
22
 
23
  # Install the Python dependencies
24
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt && rm -rf /root/.cache
25
 
26
+ # Create a directory for cache and set permissions (có thể không cần thiết)
27
+ # RUN mkdir -p $HOME/.cache && chmod 777 $HOME/.cache (Thử bỏ dòng này nếu không gặp vấn đề)
 
 
 
28
 
29
  # Set the working directory for the application
30
+ WORKDIR /home/user
31
 
32
  RUN pwd && ls -l
33