跳至主要内容

博文

目前显示的是 七月, 2017的博文

Docker multi-stage builds

Docker multi-stage builds Docker 17.06 introduced a new feature, Multi-stage builds, check the Docker blog entry multi stage builds or new multistage builds section in the docker official documentation for more details.

I tried to add a multi-stage Dockefile to build my sample project angularjs-springmvc-sample-boot into Docker images and run it in Docker container.

FROM node:latest AS ui WORKDIR /usr/src/ui COPY package.json . # Setup NPM mirror, optionally for China users. # RUN npm config set registry https://registry.npm.taobao.org/ RUN npm install COPY . . RUN node_modules/.bin/bower install --allow-root RUN node_modules/.bin/gulp FROM maven:latest AS boot WORKDIR /usr/src/app COPY pom.xml . # COPY settings.xml /usr/share/maven/ref/settings-docker.xml RUN mvn -B -f pom.xml -s /usr/share/maven/ref/settings-docker.xml dependency:resolve COPY . . RUN mvn -B -s /usr/share/maven/ref/settings-docker.xml clean package -DskipTests FROM java:8-jdk-alpine WORKDIR /static COPY --from…