Minimise the amount of cache busted by a changed ARG

Change-type: patch
This commit is contained in:
Pagan Gazzard 2019-07-19 16:54:06 +01:00
parent 0ad5d8688c
commit 1366abc7b1
2 changed files with 8 additions and 10 deletions

View File

@ -34,7 +34,6 @@ FROM balenalib/amd64-node:6-build as i386-nlp-node-build
FROM $ARCH-node-build as node-build FROM $ARCH-node-build as node-build
ARG NPM_VERSION
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -51,6 +50,7 @@ RUN apt-get update \
COPY package.json package-lock.json /usr/src/app/ COPY package.json package-lock.json /usr/src/app/
ARG NPM_VERSION
# We first ensure that every architecture has an npm version # We first ensure that every architecture has an npm version
# which can do an npm ci, then we perform the ci using this # which can do an npm ci, then we perform the ci using this
# temporary version # temporary version
@ -73,8 +73,6 @@ RUN npm test \
# Build nodejs dependencies # Build nodejs dependencies
FROM $ARCH-node-base as node-deps FROM $ARCH-node-base as node-deps
ARG ARCH
ARG NPM_VERSION
RUN [ "cross-build-start" ] RUN [ "cross-build-start" ]
@ -96,6 +94,7 @@ RUN mkdir -p rootfs-overlay && \
COPY package.json package-lock.json /usr/src/app/ COPY package.json package-lock.json /usr/src/app/
ARG NPM_VERSION
# Install only the production modules that have C extensions # Install only the production modules that have C extensions
RUN curl -LOJ https://www.npmjs.com/install.sh && \ RUN curl -LOJ https://www.npmjs.com/install.sh && \
npm config set unsafe-perm true && \ npm config set unsafe-perm true && \
@ -125,9 +124,6 @@ RUN [ "cross-build-end" ]
# Minimal runtime image # Minimal runtime image
FROM balena/$ARCH-supervisor-base:v1.4.7 FROM balena/$ARCH-supervisor-base:v1.4.7
ARG ARCH
ARG VERSION=master
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -140,6 +136,9 @@ COPY avahi-daemon.conf /etc/avahi/avahi-daemon.conf
VOLUME /data VOLUME /data
ARG ARCH
ARG VERSION=master
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
ENV CONFIG_MOUNT_POINT=/boot/config.json \ ENV CONFIG_MOUNT_POINT=/boot/config.json \
LED_FILE=/dev/null \ LED_FILE=/dev/null \
SUPERVISOR_IMAGE=resin/$ARCH-supervisor \ SUPERVISOR_IMAGE=resin/$ARCH-supervisor \

View File

@ -26,10 +26,6 @@ RUN echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-start && chmod +x /usr/bin/c
FROM $ARCH-base AS node-build FROM $ARCH-base AS node-build
FROM $ARCH-base AS node-deps FROM $ARCH-base AS node-deps
ARG ARCH
ARG VERSION=master
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
RUN [ "cross-build-start" ] RUN [ "cross-build-start" ]
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -62,6 +58,9 @@ COPY entry.sh .
RUN mkdir -p rootfs-overlay && \ RUN mkdir -p rootfs-overlay && \
(([ ! -d rootfs-overlay/lib64 ] && ln -s /lib rootfs-overlay/lib64) || true) (([ ! -d rootfs-overlay/lib64 ] && ln -s /lib rootfs-overlay/lib64) || true)
ARG ARCH
ARG VERSION=master
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
ENV CONFIG_MOUNT_POINT=/boot/config.json \ ENV CONFIG_MOUNT_POINT=/boot/config.json \
LED_FILE=/dev/null \ LED_FILE=/dev/null \
SUPERVISOR_IMAGE=resin/$ARCH-supervisor \ SUPERVISOR_IMAGE=resin/$ARCH-supervisor \