Monorepos NX NestJS Docker

# Start from node base imageFROM node:12-alpine as builder# Set the current working directory inside the containerWORKDIR /build# Copy package.json, yarn.lock files and download depsCOPY package.json yarn.lock ./RUN yarn global add @angular/cliRUN yarn# Copy sources to the working directoryCOPY . .# Set the node environmentARG node_env=productionENV NODE_ENV $node_env# Build the Node.js appARG projectRUN ng build $project# Start a new stage from nginxFROM nginx:alpineWORKDIR /dist# Copy the build artifacts from the previous stageARG projectCOPY --from=builder /build/dist/apps/$project /usr/share/nginx/html# Set the port number and expose itARG port=80ENV PORT $portEXPOSE $port# Run nginxCMD ["nginx", "-g", "daemon off;"]
Plain Polecat