From 50caa3ac3e1340616a893873d6894523de6be019 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 21 Feb 2020 15:33:54 +0100 Subject: [PATCH] ui: update static docker image to download NPM modules --- .dockerignore | 1 + passbook/static/{ => static}/robots.txt | 0 static.Dockerfile | 19 ++++++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) rename passbook/static/{ => static}/robots.txt (100%) diff --git a/.dockerignore b/.dockerignore index 366a6bf0e..951ccaf83 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ helm passbook-ui static *.env.yml +node_modules/ diff --git a/passbook/static/robots.txt b/passbook/static/static/robots.txt similarity index 100% rename from passbook/static/robots.txt rename to passbook/static/static/robots.txt diff --git a/static.Dockerfile b/static.Dockerfile index 9abd2b163..c5dafb4be 100644 --- a/static.Dockerfile +++ b/static.Dockerfile @@ -34,7 +34,20 @@ ENV PASSBOOK_POSTGRESQL__USER=passbook ENV PASSBOOK_POSTGRESQL__PASSWORD="EK-5jnKfjrGRm<77" RUN ./manage.py collectstatic --no-input -FROM beryju/pixie:latest +FROM node as npm-packager -COPY --from=static-build /app/static /web-root/static/ -COPY --from=static-build /app/static/robots.txt /web-root/robots.txt +COPY --from=static-build /app/static/package.json /static/package.json +COPY --from=static-build /app/static/yarn.lock /static/yarn.lock + +RUN cd /static && yarn + +FROM nginx + +COPY --from=static-build /app/static /usr/share/nginx/html/static +COPY --from=static-build /app/static/robots.txt /usr/share/nginx/html/robots.txt +COPY --from=npm-packager /static/node_modules /usr/share/nginx/html/static/node_modules + +# FROM beryju/pixie:latest + +# COPY --from=static-build /app/static /web-root/static/ +# COPY --from=static-build /app/static/robots.txt /web-root/robots.txt