diff --git a/.dockerignore b/.dockerignore index 186fcec..784ce70 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,7 @@ * !dist !bin -!nginx \ No newline at end of file +!nginx +!src +!package.json +!gulpfile.js \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e455e61..ba6bab5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,10 +12,22 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +FROM node:10-alpine AS builder + +WORKDIR /usr/app + +COPY package.json . + +RUN yarn install + +COPY . . + +RUN yarn build + FROM nginx:alpine LABEL maintainer="Jones MAGLOIRE @Joxit" WORKDIR /usr/share/nginx/html/ -COPY dist/ /usr/share/nginx/html/ +COPY --from=builder /usr/app/dist/ /usr/share/nginx/html/ \ No newline at end of file diff --git a/static.dockerfile b/static.dockerfile index 6349af2..5b73248 100644 --- a/static.dockerfile +++ b/static.dockerfile @@ -12,6 +12,18 @@ # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . +FROM node:10-alpine AS builder + +WORKDIR /usr/app + +COPY package.json . + +RUN yarn install + +COPY . . + +RUN yarn build + FROM nginx:alpine LABEL maintainer="Jones MAGLOIRE @Joxit" @@ -19,8 +31,8 @@ LABEL maintainer="Jones MAGLOIRE @Joxit" WORKDIR /usr/share/nginx/html/ COPY nginx/default.conf /etc/nginx/conf.d/default.conf -COPY 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/ /usr/share/nginx/html/ +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 ENTRYPOINT entrypoint