Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. FROM node:14-alpine3.13 as builder
  2. # send signal to containers to stop them
  3. STOPSIGNAL SIGTERM
  4. # create working directory
  5. RUN mkdir -p /usr/src/app
  6. # set working directory
  7. WORKDIR /usr/src/app
  8. # copy package.json file to working directory
  9. # COPY ../../../package.json ./
  10. # install dependencies with precise, for more stories visit - https://yarnpkg.com/lang/en/docs/cli/install/
  11. # RUN yarn install --silent --non-interactive --frozen-lockfile --ignore-optional
  12. RUN npm config set registry https://registry.npm.taobao.org
  13. RUN npm install vuepress -g
  14. RUN npm install -D vuepress-theme-hope vuepress
  15. COPY . .
  16. # RUN PUBLIC_URL=/ npm run docs:build
  17. RUN vuepress build
  18. # FROM nginx:1.19.4-alpine as app
  19. # Add bash
  20. # RUN apk add --no-cache bash
  21. FROM debian:buster-slim
  22. RUN apt-get update \
  23. && apt-get install -y nginx openssl
  24. RUN rm -rf /usr/share/nginx/html/*
  25. COPY --from=builder /usr/src/app/docs/conf/nginx.conf /etc/nginx/nginx.conf
  26. COPY --from=builder /usr/src/app/docs/conf/general.conf /etc/nginx/general.conf
  27. COPY --from=builder /usr/src/app/docs/conf/security.conf /etc/nginx/security.conf
  28. COPY --from=builder /usr/src/app/.vuepress/dist /usr/share/nginx/html
  29. # COPY --from=builder /usr/src/app/.env /usr/share/nginx/html/.env
  30. EXPOSE 80
  31. STOPSIGNAL SIGTERM
  32. CMD ["nginx", "-g", "daemon off;"]