Skip to content

Commit

Permalink
Dockerfile updates, and npm audit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelberston committed Nov 19, 2024
1 parent 9fb7c56 commit a9a3fc3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
15 changes: 9 additions & 6 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-alpine
FROM node:20-alpine3.19

# Set working directory
WORKDIR /auth-server
Expand All @@ -8,15 +8,18 @@ RUN addgroup -S appgroup && adduser -S appuser -G appgroup

# Install dependencies
COPY package.json package-lock.json ./
RUN npm install --production
RUN npm ci --production
RUN npm audit --audit-level=moderate && \
npm cache clean --force

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

# Set ownership and permissions
RUN chown -R appuser:appgroup /auth-server && \
mkdir logs && \
chown -R appuser:appgroup /auth-server/logs
RUN mkdir logs && \
chown -R appuser:appgroup /auth-server/logs && \
chmod -R 550 /auth-server && \
chmod -R 770 /auth-server/logs

# Switch to non-root user
USER appuser
Expand Down
6 changes: 3 additions & 3 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use the official Node.js LTS image
FROM node:20-alpine
FROM node:20-alpine3.19

# Create a non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
Expand All @@ -11,7 +11,9 @@ WORKDIR /usr/src/app
COPY --chown=appuser:appgroup package*.json ./

# Install dependencies
RUN npm install --production
RUN npm ci --production
RUN npm audit --audit-level=moderate && \
npm cache clean --force

# Copy the rest of the application code with correct ownership
COPY --chown=appuser:appgroup . .
Expand Down

0 comments on commit a9a3fc3

Please sign in to comment.