Skip to content

Commit 0b6bcec

Browse files
committed
chore/security : fix Dockerfile vulnerabilities
1 parent 6af0c29 commit 0b6bcec

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

web/lrm/client/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ COPY --from=builder /app/.output ./.output
2929
COPY --from=builder /app/node_modules ./node_modules
3030
COPY --from=builder /app/public ./public
3131

32+
# Create non-root user for security
33+
RUN addgroup -g 1001 -S app
34+
RUN adduser -S app -u 1001 -G app
35+
36+
# Change ownership of the app directory to the non-root user
37+
RUN chown -R app:app /app
38+
3239
ENV NUXT_HOST=0.0.0.0
3340
ENV NUXT_PORT=3000
3441

3542
# Expose port 3000
3643
EXPOSE 3000
3744

45+
# Switch to non-root user
46+
USER app
47+
3848
# Start the web app
3949
CMD ["npm", "start"]

web/lrm/server/Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,22 @@ RUN npm ci --omit=dev
3131
# Copy build directory from stage 1
3232
COPY --from=build /app/dist .
3333

34+
# Create non-root user for security
35+
RUN addgroup -g 1001 -S app
36+
RUN adduser -S app -u 1001 -G app
37+
38+
# Change ownership of the app directory to the non-root user
39+
RUN chown -R app:app /app
40+
3441
# Setup ENV variable
3542
ENV NODE_ENV=production
3643
ENV PORT=80
3744

3845
# Expose port 80 to allow incoming traffic
3946
EXPOSE 80
4047

48+
# Switch to non-root user
49+
USER app
50+
4151
# Start the Node web server
4252
CMD ["node", "index.js"]

0 commit comments

Comments
 (0)