Skip to content

Commit

Permalink
Merge pull request #443 from bcgov/bug/permissions-issue
Browse files Browse the repository at this point in the history
Update Dockerfile
  • Loading branch information
barrfalk authored Jan 11, 2024
2 parents 16df06f + d553710 commit 2ed364b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ ENV NPM_CONFIG_CACHE=/opt/app-root/src/app/.npm-cache
# Set working directory
WORKDIR /opt/app-root/src/app

# Copy application source code and set ownership
# Copy application source code
COPY . /opt/app-root/src

# Switch to root user to change ownership
USER root

# Create the npm cache directory and ensure the correct ownership
RUN mkdir -p $NPM_CONFIG_CACHE && chown -R 1001:1001 /opt/app-root/src/app

# Switch back to non-root user
USER 1001:1001

# Install dependencies and build the application
RUN npm run all:ci \
&& npm run all:build \
Expand All @@ -24,4 +30,4 @@ RUN npm run all:ci \
EXPOSE 8000

# Start the application
CMD ["sh", "-c", "chown -R 1001:1001 /opt/app-root/src/app/.npm-cache && npm run start"]
CMD ["npm", "run", "start"]

0 comments on commit 2ed364b

Please sign in to comment.