Skip to content

Commit

Permalink
Fix Dockerfile due to permission issues with npm
Browse files Browse the repository at this point in the history
  • Loading branch information
mpgxvii committed Sep 28, 2024
1 parent 49aed05 commit c97167c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
# LTS version of Node.js
FROM node:20.9.0-alpine

# Create a new user and group for running the application
RUN addgroup -S appgroup && adduser -S appuser -G appgroup

RUN mkdir -p /app

WORKDIR /app

COPY package*.json ./

RUN npm install
# Change ownership of the app directory
RUN chown -R appuser:appgroup /app

# Install npm dependencies as the non-root user
USER appuser

# Clear npm cache and install dependencies
RUN npm cache clean --force && npm install

COPY . .
# Copy the rest of the application code
COPY --chown=appuser:appgroup . .

RUN npm run build

EXPOSE 3000

# Start the app on port 4455 as recommended by ory
CMD ["npm", "start", "--", "-p", "3000"]

0 comments on commit c97167c

Please sign in to comment.