Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +10 -10
Dockerfile
CHANGED
@@ -18,15 +18,15 @@ WORKDIR /app
|
|
18 |
|
19 |
# Create a non-privileged user that the app will run under.
|
20 |
# See https://docs.docker.com/go/dockerfile-user-best-practices/
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
# Download dependencies as a separate step to take advantage of Docker's caching.
|
32 |
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
|
@@ -37,7 +37,7 @@ RUN --mount=type=cache,target=/root/.cache/pip \
|
|
37 |
python -m pip install -r requirements.txt
|
38 |
|
39 |
# Switch to the non-privileged user to run the application.
|
40 |
-
|
41 |
|
42 |
# Copy the source code into the container.
|
43 |
COPY . .
|
|
|
18 |
|
19 |
# Create a non-privileged user that the app will run under.
|
20 |
# See https://docs.docker.com/go/dockerfile-user-best-practices/
|
21 |
+
ARG UID=10001
|
22 |
+
RUN adduser \
|
23 |
+
--disabled-password \
|
24 |
+
--gecos "" \
|
25 |
+
--home "/nonexistent" \
|
26 |
+
--shell "/sbin/nologin" \
|
27 |
+
--no-create-home \
|
28 |
+
--uid "${UID}" \
|
29 |
+
appuser
|
30 |
|
31 |
# Download dependencies as a separate step to take advantage of Docker's caching.
|
32 |
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
|
|
|
37 |
python -m pip install -r requirements.txt
|
38 |
|
39 |
# Switch to the non-privileged user to run the application.
|
40 |
+
USER appuser
|
41 |
|
42 |
# Copy the source code into the container.
|
43 |
COPY . .
|