Try to fix user-related issues.
Browse files- Dockerfile +4 -7
Dockerfile
CHANGED
@@ -10,24 +10,21 @@ RUN apt-get -y update && apt-get -y install python3-pip
|
|
10 |
|
11 |
RUN cat /etc/passwd
|
12 |
|
13 |
-
# Set up a new user named "user"
|
14 |
-
RUN useradd -m -o -u 1000 user
|
15 |
-
|
16 |
# Switch to the "user" user
|
17 |
-
USER
|
18 |
|
19 |
RUN pip3 install --break-system-packages --no-cache-dir --upgrade setuptools pip
|
20 |
|
21 |
RUN pip3 install --break-system-packages --no-cache-dir --upgrade -r /code/requirements.txt
|
22 |
|
23 |
# Set home to the user's home directory
|
24 |
-
ENV HOME=/home/
|
25 |
-
PATH=/home/
|
26 |
|
27 |
# Set the working directory to the user's home directory
|
28 |
WORKDIR $HOME/app
|
29 |
|
30 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
31 |
-
COPY --chown=
|
32 |
|
33 |
CMD ["python3", "app.py"]
|
|
|
10 |
|
11 |
RUN cat /etc/passwd
|
12 |
|
|
|
|
|
|
|
13 |
# Switch to the "user" user
|
14 |
+
USER ubuntu
|
15 |
|
16 |
RUN pip3 install --break-system-packages --no-cache-dir --upgrade setuptools pip
|
17 |
|
18 |
RUN pip3 install --break-system-packages --no-cache-dir --upgrade -r /code/requirements.txt
|
19 |
|
20 |
# Set home to the user's home directory
|
21 |
+
ENV HOME=/home/ubuntu \
|
22 |
+
PATH=/home/ubuntu/.local/bin:$PATH
|
23 |
|
24 |
# Set the working directory to the user's home directory
|
25 |
WORKDIR $HOME/app
|
26 |
|
27 |
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
28 |
+
COPY --chown=ubuntu . $HOME/app
|
29 |
|
30 |
CMD ["python3", "app.py"]
|