# This Dockerfile allows you to run NextJS in a static container (no server side) ######### # Build # ######### FROM docker.io/node:alpine as BUILD_IMAGE # inform software to be in production ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 # External deps (for node-gyp add: "python3 make g++") # git is used to install the npm packages with git deps RUN apk add --no-cache git # run as non root user USER node # go to user repository WORKDIR /home/node # Add package json ADD package.json package-lock.json ./ # install dependencies from package lock RUN npm ci --omit=dev # Add project files ADD . . # build RUN npm run build &&\ npm run export ############## # Production # ############## FROM docker.io/nginx:alpine # go to NGINX folder WORKDIR /usr/share/nginx/html # copy from build image COPY --from=BUILD_IMAGE /home/node/out ./