Browse Source

fix: 调整Dockderfile

pull/126/head
wangjun 3 years ago
parent
commit
9777fedf0b
  1. 20
      vben28/Dockerfile
  2. 18
      vben28/Dockerfile.ci

20
vben28/Dockerfile

@ -1,9 +1,17 @@
FROM nginx:1.17.3-alpine as base FROM node:16-alpine as build-stage
EXPOSE 80 WORKDIR /app
COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=16384
RUN npm install pnpm -g
RUN pnpm i
RUN npm run build
COPY /_nginx/nginx.conf /etc/nginx/nginx.conf FROM nginx:1.17.3-alpine as production-stage
COPY /_nginx/env.js /etc/nginx/env.js COPY --from=build-stage app/_nginx/nginx.conf /etc/nginx/nginx.conf
COPY /_nginx/default.conf /etc/nginx/conf.d/default.conf COPY --from=build-stage app/_nginx/env.js /etc/nginx/env.js
COPY /dist/ /usr/share/nginx/html COPY --from=build-stage app/_nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage app/dist/ /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

18
vben28/Dockerfile.ci

@ -1,18 +0,0 @@
FROM node:16-alpine as build-stage
WORKDIR /app
COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=16384
RUN npm install pnpm -g
RUN pnpm i
RUN pnpm build
FROM nginx:1.17.3-alpine as production-stage
COPY --from=build-stage app/_nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=build-stage app/_nginx/env.js /etc/nginx/env.js
COPY --from=build-stage app/_nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage app/dist/ /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Loading…
Cancel
Save