Update dockerfile to cache dependencies

This commit is contained in:
Evan Cordell 2017-07-10 22:34:41 -04:00
parent dacb0131a5
commit 1ef2308e41

View file

@ -3,7 +3,6 @@
FROM quay.io/quay/quay-base:latest FROM quay.io/quay/quay-base:latest
WORKDIR $QUAYDIR WORKDIR $QUAYDIR
COPY . .
# Install python dependencies # Install python dependencies
RUN virtualenv --distribute venv \ 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) && \ test -z $(cat pipinfo.txt | grep GPL | grep -v LGPL) && \
rm pipinfo.txt rm pipinfo.txt
# Install front-end dependencies and Optimize our images # Install front-end dependencies
RUN yarn install --ignore-engines \ ADD package.json package.json
&& yarn build \ ADD tsconfig.json tsconfig.json
&& jpegoptim static/img/**/*.jpg \ ADD webpack.config.js webpack.config.js
&& optipng -clobber -quiet static/img/**/*.png 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 # 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/ \ 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 # && apt-get clean
# && rm -rf /root/.npm /.npm /usr/local/lib/node_modules /usr/share/yarn/node_modules \ # && rm -rf /root/.npm /.npm /usr/local/lib/node_modules /usr/share/yarn/node_modules \
# /root/node_modules /node_modules /grunt # /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 RUN PYTHONPATH=$QUAYPATH venv/bin/alembic heads | grep -E '^[0-9a-f]+ \(head\)$' > ALEMBIC_HEAD