# PHASE 1: copy and build FROM node:alpine AS build WORKDIR /app COPY . . RUN rm -rf node_modules && npm install && npm run build # PHASE 2: prepare for exec FROM node:alpine AS exec WORKDIR /app COPY --from=build /app/. . EXPOSE 3000 CMD ["npm", "run", "start"]