From 1ef2308e41d37127e09f9fbfb80c85a6f19fe3db Mon Sep 17 00:00:00 2001 From: Evan Cordell Date: Mon, 10 Jul 2017 22:34:41 -0400 Subject: [PATCH] Update dockerfile to cache dependencies --- Dockerfile | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 50cca45df..31957f0e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,6 @@ FROM quay.io/quay/quay-base:latest WORKDIR $QUAYDIR -COPY . . # Install python dependencies RUN virtualenv --distribute venv \ @@ -18,11 +17,25 @@ RUN cat requirements.txt | grep -v "^-e" | awk -F'==' '{print $1}' | xargs venv/ test -z $(cat pipinfo.txt | grep GPL | grep -v LGPL) && \ rm pipinfo.txt -# Install front-end dependencies and Optimize our images -RUN yarn install --ignore-engines \ - && yarn build \ - && jpegoptim static/img/**/*.jpg \ - && optipng -clobber -quiet static/img/**/*.png +# Install front-end dependencies +ADD package.json package.json +ADD tsconfig.json tsconfig.json +ADD webpack.config.js webpack.config.js +ADD yarn.lock yarn.lock +RUN yarn install --ignore-engines + +# Add static files +ADD static static + +# Run Webpack +RUN yarn build + +# Optimize our images +ADD static/img static/img +RUN jpegoptim static/img/**/*.jpg +RUN optipng -clobber -quiet static/img/**/*.png + +COPY . . # Set up the init system RUN mkdir -p /etc/my_init.d /etc/systlog-ng /usr/local/bin /etc/monit static/fonts static/ldn /usr/local/nginx/logs/ \ @@ -42,5 +55,4 @@ RUN mkdir -p /etc/my_init.d /etc/systlog-ng /usr/local/bin /etc/monit static/fon # && apt-get clean # && rm -rf /root/.npm /.npm /usr/local/lib/node_modules /usr/share/yarn/node_modules \ # /root/node_modules /node_modules /grunt -RUN ln -s /conf $QUAYCONF RUN PYTHONPATH=$QUAYPATH venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' > ALEMBIC_HEAD