FROM node:14-alpine3.13 as builder # send signal to containers to stop them STOPSIGNAL SIGTERM # create working directory RUN mkdir -p /usr/src/app # set working directory WORKDIR /usr/src/app # copy package.json file to working directory # COPY ../../../package.json ./ # install dependencies with precise, for more stories visit - https://yarnpkg.com/lang/en/docs/cli/install/ # RUN yarn install --silent --non-interactive --frozen-lockfile --ignore-optional RUN npm config set registry https://registry.npm.taobao.org RUN npm install vuepress -g RUN npm install -D vuepress-theme-hope vuepress COPY . . # RUN PUBLIC_URL=/ npm run docs:build RUN vuepress build # FROM nginx:1.19.4-alpine as app # Add bash # RUN apk add --no-cache bash FROM debian:buster-slim RUN apt-get update \ && apt-get install -y nginx openssl RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /usr/src/app/conf/nginx.conf /etc/nginx/nginx.conf COPY --from=builder /usr/src/app/conf/general.conf /etc/nginx/general.conf COPY --from=builder /usr/src/app/conf/security.conf /etc/nginx/security.conf COPY --from=builder /usr/src/app/.vuepress/dist /opt/dist # COPY --from=builder /usr/src/app/.env /usr/share/nginx/html/.env EXPOSE 80 STOPSIGNAL SIGTERM CMD ["nginx", "-g", "daemon off;"]