From 56620c4b5f76c0950a3c5c6b592ed7c24aeb5367 Mon Sep 17 00:00:00 2001 From: "R. Richard" Date: Thu, 5 Sep 2019 18:16:53 +0200 Subject: [PATCH] Copy frontend as a multistage artifact --- Dockerfile | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index d14cc40..db441a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,14 @@ +FROM tfw-frontend:latest as frontend FROM avatao/debian:buster -RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - &&\ - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - &&\ - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list &&\ - apt-get update &&\ +RUN apt-get update &&\ apt-get install -y --no-install-recommends \ - nodejs \ - yarn \ supervisor \ libzmq5 \ nginx \ jq \ - gettext-base &&\ - rm -rf /var/lib/apt/lists/* &&\ + gettext-base &&\ + rm -rf /var/lib/apt/lists/* &&\ ln -sf /bin/bash /bin/sh COPY requirements.txt /tmp @@ -59,11 +55,11 @@ COPY nginx/default.conf ${TFW_NGINX_DEFAULT} COPY nginx/components/ ${TFW_NGINX_COMPONENTS} COPY tfw ${TFW_LIB_DIR}/tfw COPY supervisor/tfw_server.py ${TFW_SERVER_DIR}/ +COPY --from=frontend /srv/dist ${TFW_FRONTEND_DIR} VOLUME ["${TFW_LOGS_DIR}", "${TFW_PIPES_DIR}"] ONBUILD ARG BUILD_CONTEXT="solvable" -ONBUILD ARG NOFRONTEND="" ONBUILD COPY ${BUILD_CONTEXT}/nginx/ ${TFW_NGINX_COMPONENTS} ONBUILD COPY ${BUILD_CONTEXT}/supervisor/ ${TFW_SUPERVISORD_COMPONENTS} @@ -73,10 +69,5 @@ ONBUILD RUN for f in "${TFW_NGINX_DEFAULT}" ${TFW_NGINX_COMPONENTS}/*.conf; do done ONBUILD VOLUME ["/etc/nginx", "/var/lib/nginx", "/var/log/nginx", "${TFW_LIB_DIR}/tfw"] -ONBUILD COPY ${BUILD_CONTEXT}/frontend /data/ -ONBUILD RUN test -z "${NOFRONTEND}" && cd /data && yarn install --frozen-lockfile || : -ONBUILD RUN test -z "${NOFRONTEND}" && cd /data && yarn build --no-progress || : -ONBUILD RUN test -z "${NOFRONTEND}" && mv /data/dist ${TFW_FRONTEND_DIR} && rm -rf /data || : - ENTRYPOINT ["/bin/init", "--"] CMD exec supervisord --nodaemon --configuration ${TFW_SUPERVISORD_CONF}