mirror of https://github.com/Lissy93/dashy.git
🐳 refactor to add user
This commit is contained in:
parent
4f4f9963c7
commit
bbbcd09b44
29
Dockerfile
29
Dockerfile
|
@ -31,22 +31,31 @@ FROM node:16.13.2-alpine
|
||||||
ENV PORT=80 \
|
ENV PORT=80 \
|
||||||
DIRECTORY=/app \
|
DIRECTORY=/app \
|
||||||
IS_DOCKER=true \
|
IS_DOCKER=true \
|
||||||
UID=1000 \
|
USER=docker \
|
||||||
GUID=1000
|
UID=12345 \
|
||||||
|
GID=23456
|
||||||
|
|
||||||
# Create a group and user
|
# Install tini for initialization and tzdata for setting timezone
|
||||||
RUN addgroup --gid ${GUID} application \
|
RUN apk add --no-cache tzdata tini \
|
||||||
&& adduser --no-create-home --uid ${UID} application application
|
# Add group
|
||||||
|
&& addgroup --gid ${GID} "${USER}" \
|
||||||
|
# Add user
|
||||||
|
&& adduser \
|
||||||
|
--disabled-password \
|
||||||
|
--ingroup "${USER}" \
|
||||||
|
--gecos "" \
|
||||||
|
--home "${DIRECTORY}" \
|
||||||
|
--no-create-home \
|
||||||
|
--uid "$UID" \
|
||||||
|
"$USER"
|
||||||
|
|
||||||
|
USER ${USER}
|
||||||
|
|
||||||
USER application
|
|
||||||
# Create and set the working directory
|
# Create and set the working directory
|
||||||
WORKDIR ${DIRECTORY}
|
WORKDIR ${DIRECTORY}
|
||||||
|
|
||||||
# Install tini for initialization and tzdata for setting timezone
|
|
||||||
RUN apk add --no-cache tzdata tini
|
|
||||||
|
|
||||||
# Copy built application from build phase
|
# Copy built application from build phase
|
||||||
COPY --from=BUILD_IMAGE /app ./
|
COPY --from=BUILD_IMAGE --chown=${USER}:${USER} /app ./
|
||||||
|
|
||||||
# Finally, run start command to serve up the built application
|
# Finally, run start command to serve up the built application
|
||||||
ENTRYPOINT [ "/sbin/tini", "--" ]
|
ENTRYPOINT [ "/sbin/tini", "--" ]
|
||||||
|
|
Loading…
Reference in New Issue