Browse Source

Added Docker support

maziggy 5 months ago
parent
commit
8618159baa
1 changed files with 9 additions and 2 deletions
  1. 9 2
      Dockerfile

+ 9 - 2
Dockerfile

@@ -3,10 +3,17 @@ FROM node:22-alpine AS frontend-builder
 
 
 WORKDIR /app/frontend
 WORKDIR /app/frontend
 
 
-COPY frontend/package*.json ./
+# Create non-root user for npm
+RUN addgroup -g 1001 -S nodejs && \
+    adduser -S nodejs -u 1001 -G nodejs && \
+    chown -R nodejs:nodejs /app
+
+USER nodejs
+
+COPY --chown=nodejs:nodejs frontend/package*.json ./
 RUN npm ci
 RUN npm ci
 
 
-COPY frontend/ ./
+COPY --chown=nodejs:nodejs frontend/ ./
 RUN npm run build
 RUN npm run build
 
 
 # Production image
 # Production image