# Build stage FROM node:20-alpine AS builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Runtime stage FROM node:20-alpine # Install wget for health checks RUN apk --no-cache add wget WORKDIR /app # Copy dependencies from builder COPY --from=builder /app/node_modules ./node_modules # Copy application files COPY package*.json ./ COPY index.js index-standalone.js ./ COPY public ./public COPY src ./src # Create non-root user (let Alpine assign available GID/UID) RUN addgroup spore && \ adduser -D -s /bin/sh -G spore spore && \ chown -R spore:spore /app USER spore # Expose port EXPOSE 3000 # Run the application CMD ["node", "index.js"]