FROM node:20-alpine WORKDIR /app # Copy package files COPY package*.json ./ # Install production dependencies RUN npm install --production # Copy application files COPY . . # Set production environment ENV NODE_ENV=production # Expose port EXPOSE 8545 # Run as non-root user RUN addgroup -g 1001 -S nodejs RUN adduser -S nodejs -u 1001 USER nodejs # Start the application CMD ["node", "index.js"]