# Stage 0, "build-stage", based on Node.js, to build and compile the frontend FROM node:19 as build-stage # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) # Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer # installs, work. RUN apt-get update && apt-get install -y wget --no-install-recommends \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ && apt-get update \ && apt-get install -y google-chrome-unstable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \ --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ && apt-get purge --auto-remove -y curl \ && rm -rf /src/*.deb WORKDIR /app RUN npm install puppeteer COPY package*.json /app/ RUN npm install COPY ./ /app/ ARG FRONTEND_ENV=production ENV VUE_APP_ENV=${FRONTEND_ENV} # Comment out the next line to disable tests #RUN npm run test:unit RUN npm run build # Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx FROM nginx:1.23 COPY --from=build-stage /app/dist/ /usr/share/nginx/html COPY --from=build-stage /app/googlee455ea492ff4b8ca.html /usr/share/nginx/html/googlee455ea492ff4b8ca.html COPY --from=build-stage /app/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=build-stage /app/nginx-backend-not-found.conf /etc/nginx/extra-conf.d/backend-not-found.conf