molinari135
commited on
Commit
•
15d41d0
1
Parent(s):
855ce9d
Update Dockerfile
Browse files- Dockerfile +6 -3
Dockerfile
CHANGED
@@ -3,15 +3,15 @@ FROM python:3.12-slim
|
|
3 |
# Set up a new user with user ID 1000
|
4 |
RUN useradd -m -u 1000 user
|
5 |
|
6 |
-
# Switch to
|
7 |
-
USER
|
8 |
|
9 |
# Set environment variables for the user
|
10 |
ENV HOME=/home/user \
|
11 |
PATH=/home/user/.local/bin:$PATH
|
12 |
|
13 |
# Set the working directory to the user's home directory
|
14 |
-
WORKDIR
|
15 |
|
16 |
# Upgrade pip
|
17 |
RUN pip install --no-cache-dir --upgrade pip==23.3.1
|
@@ -21,6 +21,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
21 |
build-essential && \
|
22 |
rm -rf /var/lib/apt/lists/*
|
23 |
|
|
|
|
|
|
|
24 |
# Copy the application code into the container at $HOME/app and set the ownership to the "user"
|
25 |
COPY --chown=user product_return_prediction $HOME/app/product_return_prediction
|
26 |
COPY --chown=user README.md $HOME/app/
|
|
|
3 |
# Set up a new user with user ID 1000
|
4 |
RUN useradd -m -u 1000 user
|
5 |
|
6 |
+
# Switch to root user temporarily for installing system dependencies
|
7 |
+
USER root
|
8 |
|
9 |
# Set environment variables for the user
|
10 |
ENV HOME=/home/user \
|
11 |
PATH=/home/user/.local/bin:$PATH
|
12 |
|
13 |
# Set the working directory to the user's home directory
|
14 |
+
WORKDIR /home/user/app
|
15 |
|
16 |
# Upgrade pip
|
17 |
RUN pip install --no-cache-dir --upgrade pip==23.3.1
|
|
|
21 |
build-essential && \
|
22 |
rm -rf /var/lib/apt/lists/*
|
23 |
|
24 |
+
# Switch back to the "user" user
|
25 |
+
USER user
|
26 |
+
|
27 |
# Copy the application code into the container at $HOME/app and set the ownership to the "user"
|
28 |
COPY --chown=user product_return_prediction $HOME/app/product_return_prediction
|
29 |
COPY --chown=user README.md $HOME/app/
|