🐳 add user in dockerfile

This commit is contained in:
Singebob 2022-02-17 15:52:07 +01:00
parent bb4658e16c
commit 4f4f9963c7
No known key found for this signature in database
GPG Key ID: A079858ACE1F77DE
1 changed files with 8 additions and 1 deletions

View File

@ -30,8 +30,15 @@ FROM node:16.13.2-alpine
# Define some ENV Vars # Define some ENV Vars
ENV PORT=80 \ ENV PORT=80 \
DIRECTORY=/app \ DIRECTORY=/app \
IS_DOCKER=true IS_DOCKER=true \
UID=1000 \
GUID=1000
# Create a group and user
RUN addgroup --gid ${GUID} application \
&& adduser --no-create-home --uid ${UID} application application
USER application
# Create and set the working directory # Create and set the working directory
WORKDIR ${DIRECTORY} WORKDIR ${DIRECTORY}