2020年9月14日星期一

Example of Multi-Stage Docker file builder

1. Multi Stage Dockerfile build (node.js vue.js helloworld)

  ref:https://github.com/lqwangxg/vuechat     Dockerfile

FROM lqwangxg/node:alpine AS builder
WORKDIR /vuechat
RUN npm install -g @vue/cli @vue/cli-service-global 
COPY package*.json /vuechat/
RUN npm install
COPY . /vuechat/
RUN npm run build

FROM nginx:alpine
COPY --from=builder /vuechat/dist /usr/share/nginx/html

2. Multi Stage Dockerfile build 

FROM alpine:latest as builder
RUN apk --no-cache add build-base

FROM builder as build1
COPY source1.cpp source.cpp
RUN g++ -o /binary source.cpp

FROM builder as build2
COPY source2.cpp source.cpp RUN g++ -o /binary source.cpp ###======================= FROM production_image_template #... RUN ... to make the destination Image

没有评论: