# FROM node:20-alpine as build-stage # WORKDIR /app # COPY package*.json ./ # RUN npm install # COPY . . # RUN npm run build # FROM node:20-alpine as production-stage # WORKDIR /app # COPY --from=build-stage /app /app # EXPOSE 3000 # ENV NODE_ENV=production # CMD ["npm", "run", "start"] # Use a Debian-based image instead of Alpine to avoid musl-related issues FROM node:20-slim WORKDIR /app COPY package*.json ./ # 1. Clean npm cache # 2. Force install optional dependencies # 3. Use --legacy-peer-deps if needed RUN npm cache clean --force && \ npm install --include=optional --legacy-peer-deps COPY . . RUN npm run build EXPOSE 3000 CMD ["npm", "start"]