FROM node:18-alpine WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm install # Copy source code COPY . . # Create non-root user RUN addgroup -g 1001 -S nodejs RUN adduser -S reactuser -u 1001 # Change ownership RUN chown -R reactuser:nodejs /app USER reactuser EXPOSE 3000 CMD ["npm", "start"]