Docker分阶段构建WEB前端项目镜像

  sre

5fc9fddfe17394881.jpg_fo742.png

FROM node:alpine as builder
WORKDIR '/build'
COPY dir1 ./dir1
COPY resources ./resources
COPY third_party ./third_party

WORKDIR '/build/dir1'

RUN npm install
RUN npm rebuild node-sass
RUN npm run build 

RUN ls /build/dir1/dist 

FROM nginx
EXPOSE 80 
COPY --from=builder /build/dir1/dist /usr/share/nginx/html 

LEAVE A COMMENT

Captcha Code