[docker-multi-stage] Add multi-stage-build for alpine version

This commit is contained in:
Joxit 2018-12-23 19:41:11 +01:00
parent 1e185b4034
commit 89e2782751
3 changed files with 31 additions and 4 deletions

View file

@ -1,4 +1,7 @@
* *
!dist !dist
!bin !bin
!nginx !nginx
!src
!package.json
!gulpfile.js

View file

@ -12,10 +12,22 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
FROM node:10-alpine AS builder
WORKDIR /usr/app
COPY package.json .
RUN yarn install
COPY . .
RUN yarn build
FROM nginx:alpine FROM nginx:alpine
LABEL maintainer="Jones MAGLOIRE @Joxit" LABEL maintainer="Jones MAGLOIRE @Joxit"
WORKDIR /usr/share/nginx/html/ WORKDIR /usr/share/nginx/html/
COPY dist/ /usr/share/nginx/html/ COPY --from=builder /usr/app/dist/ /usr/share/nginx/html/

View file

@ -12,6 +12,18 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
FROM node:10-alpine AS builder
WORKDIR /usr/app
COPY package.json .
RUN yarn install
COPY . .
RUN yarn build
FROM nginx:alpine FROM nginx:alpine
LABEL maintainer="Jones MAGLOIRE @Joxit" LABEL maintainer="Jones MAGLOIRE @Joxit"
@ -19,8 +31,8 @@ LABEL maintainer="Jones MAGLOIRE @Joxit"
WORKDIR /usr/share/nginx/html/ WORKDIR /usr/share/nginx/html/
COPY nginx/default.conf /etc/nginx/conf.d/default.conf COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY dist/ /usr/share/nginx/html/ COPY --from=builder /usr/app/dist/ /usr/share/nginx/html/
COPY dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js COPY --from=builder /usr/app/dist/scripts/docker-registry-ui-static.js /usr/share/nginx/html/scripts/docker-registry-ui.js
COPY bin/entrypoint /bin COPY bin/entrypoint /bin
ENTRYPOINT entrypoint ENTRYPOINT entrypoint