File tree 1 file changed +21
-5
lines changed
1 file changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -30,16 +30,32 @@ FROM node:16.13.2-alpine
30
30
# Define some ENV Vars
31
31
ENV PORT=80 \
32
32
DIRECTORY=/app \
33
- IS_DOCKER=true
33
+ IS_DOCKER=true \
34
+ USER=docker \
35
+ UID=12345 \
36
+ GID=23456
37
+
38
+ # Install tini for initialization and tzdata for setting timezone
39
+ RUN apk add --no-cache tzdata tini \
40
+ # Add group
41
+ && addgroup --gid ${GID} "${USER}" \
42
+ # Add user
43
+ && adduser \
44
+ --disabled-password \
45
+ --ingroup "${USER}" \
46
+ --gecos "" \
47
+ --home "${DIRECTORY}" \
48
+ --no-create-home \
49
+ --uid "$UID" \
50
+ "$USER"
51
+
52
+ USER ${USER}
34
53
35
54
# Create and set the working directory
36
55
WORKDIR ${DIRECTORY}
37
56
38
- # Install tini for initialization and tzdata for setting timezone
39
- RUN apk add --no-cache tzdata tini
40
-
41
57
# Copy built application from build phase
42
- COPY --from=BUILD_IMAGE /app ./
58
+ COPY --from=BUILD_IMAGE --chown=${USER}:${USER} /app ./
43
59
44
60
# Finally, run start command to serve up the built application
45
61
ENTRYPOINT [ "/sbin/tini" , "--" ]
You can’t perform that action at this time.
0 commit comments