Skip to content

Commit

Permalink
feat: docker updated
Browse files Browse the repository at this point in the history
  • Loading branch information
soumyadip007 authored Sep 30, 2024
1 parent 85baef4 commit 1a9820b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ ARG TESTWORKFLOW
ARG DEMOWORKFLOW
ARG USERGROUP

RUN addgroup allusers && adduser -S -G allusers $USERGROUP
# Create a group and user with the specified USERGROUP ID
RUN addgroup -g $USERGROUP allusers && adduser -S -G allusers -u $USERGROUP appuser

RUN mkdir /.npm
RUN mkdir /.npm/_cacache

RUN echo "Build argument value of TESTWORKFLOW : ${TESTWORKFLOW}"
RUN echo "Build argument value of DEMOWORKFLOW : ${DEMOWORKFLOW}"

# Set the working directory
WORKDIR /app

Expand All @@ -33,12 +36,15 @@ RUN npm run build
# Remove development dependencies
RUN npm prune --production

RUN chown -R $USERGROUP:allusers .
RUN chown -R $USERGROUP:allusers ~/.npm
RUN chown -R $USERGROUP:allusers /.npm
RUN chmod -R 777 .
# Change ownership of the directories to the created user
RUN chown -R appuser:allusers /app /.npm ~/.npm
RUN chmod -R 777 /app /.npm ~/.npm

# Expose the application port
EXPOSE 3000
USER $USERGROUP

# Switch to the new user
USER appuser

# Start the application
CMD ["npm", "start"]

0 comments on commit 1a9820b

Please sign in to comment.