mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-05-31 14:50:47 +00:00
Ensure that all architectures use a node version that supports ci
We do this by using the standalone installer pinned at v6.9.0. We use the standalone installer because npm itself fails to upgrade on the i386-nlp build (npm v3). The standalone installer is installed in /tmp, and then to avoid mysterious CI errors, we use the original npm to run the tests. Change-type: patch Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
parent
fe8ebfc0b0
commit
557f88965a
27
Dockerfile
27
Dockerfile
@ -1,4 +1,5 @@
|
|||||||
ARG ARCH=amd64
|
ARG ARCH=amd64
|
||||||
|
ARG NPM_VERSION=6.9.0
|
||||||
|
|
||||||
# The node version here should match the version of the runtime image which is
|
# The node version here should match the version of the runtime image which is
|
||||||
# specified in the base-image subdirectory in the project
|
# specified in the base-image subdirectory in the project
|
||||||
@ -33,6 +34,8 @@ 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
|
||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
@ -43,12 +46,20 @@ RUN apt-get update \
|
|||||||
make \
|
make \
|
||||||
python \
|
python \
|
||||||
rsync \
|
rsync \
|
||||||
wget \
|
curl \
|
||||||
&& rm -rf /var/lib/apt/lists/
|
&& rm -rf /var/lib/apt/lists/
|
||||||
|
|
||||||
COPY package.json package-lock.json /usr/src/app/
|
COPY package.json package-lock.json /usr/src/app/
|
||||||
|
|
||||||
RUN JOBS=MAX npm ci --no-optional --unsafe-perm || JOBS=MAX npm install --no-optional --unsafe-perm
|
# We first ensure that every architecture has an npm version
|
||||||
|
# which can do an npm ci, then we perform the ci using this
|
||||||
|
# temporary version
|
||||||
|
RUN curl -LOJ https://www.npmjs.com/install.sh && \
|
||||||
|
# This is required to avoid a bug in uid-number
|
||||||
|
# https://github.com/npm/uid-number/issues/7
|
||||||
|
npm config set unsafe-perm true && \
|
||||||
|
npm_install="#{NPM_VERSION}" npm_config_prefix=/tmp sh ./install.sh && \
|
||||||
|
JOBS=MAX /tmp/bin/npm ci --no-optional --unsafe-perm
|
||||||
|
|
||||||
COPY webpack.config.js fix-jsonstream.js hardcode-migrations.js tsconfig.json tsconfig.release.json /usr/src/app/
|
COPY webpack.config.js fix-jsonstream.js hardcode-migrations.js tsconfig.json tsconfig.release.json /usr/src/app/
|
||||||
COPY src /usr/src/app/src
|
COPY src /usr/src/app/src
|
||||||
@ -63,6 +74,7 @@ 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 ARCH
|
||||||
|
ARG NPM_VERSION
|
||||||
|
|
||||||
RUN [ "cross-build-start" ]
|
RUN [ "cross-build-start" ]
|
||||||
|
|
||||||
@ -76,7 +88,7 @@ RUN apt-get update \
|
|||||||
make \
|
make \
|
||||||
python \
|
python \
|
||||||
rsync \
|
rsync \
|
||||||
wget \
|
curl \
|
||||||
&& rm -rf /var/lib/apt/lists/
|
&& rm -rf /var/lib/apt/lists/
|
||||||
|
|
||||||
RUN mkdir -p rootfs-overlay && \
|
RUN mkdir -p rootfs-overlay && \
|
||||||
@ -85,11 +97,10 @@ RUN mkdir -p rootfs-overlay && \
|
|||||||
COPY package.json package-lock.json /usr/src/app/
|
COPY package.json package-lock.json /usr/src/app/
|
||||||
|
|
||||||
# Install only the production modules that have C extensions
|
# Install only the production modules that have C extensions
|
||||||
RUN (if [ $ARCH = "i386-nlp" ]; then \
|
RUN curl -LOJ https://www.npmjs.com/install.sh && \
|
||||||
JOBS=MAX npm install --no-optional --unsafe-perm --production; \
|
npm config set unsafe-perm true && \
|
||||||
else \
|
npm_install="${NPM_VERSION}" npm_config_prefix=/tmp sh ./install.sh && \
|
||||||
JOBS=MAX npm ci --no-optional --unsafe-perm --production; \
|
JOBS=MAX /tmp/bin/npm ci --no-optional --unsafe-perm --production
|
||||||
fi) && npm dedupe
|
|
||||||
|
|
||||||
# Remove various uneeded filetypes in order to reduce space
|
# Remove various uneeded filetypes in order to reduce space
|
||||||
# We also remove the spurious node.dtps, see https://github.com/mapbox/node-sqlite3/issues/861
|
# We also remove the spurious node.dtps, see https://github.com/mapbox/node-sqlite3/issues/861
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
ARG ARCH=amd64
|
ARG ARCH=amd64
|
||||||
|
ARG NPM_VERSION=6.9.0
|
||||||
|
|
||||||
# The node version here should match the version of the runtime image which is
|
# The node version here should match the version of the runtime image which is
|
||||||
# specified in the base-image subdirectory in the project
|
# specified in the base-image subdirectory in the project
|
||||||
@ -36,17 +37,21 @@ RUN [ "cross-build-start" ]
|
|||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
RUN apt-get update && apt-get install ca-certificates \
|
RUN apt-get update && apt-get install ca-certificates \
|
||||||
iptables libnss-mdns nodejs rsync git python make wget g++ \
|
iptables libnss-mdns nodejs rsync git python make curl g++ \
|
||||||
kmod vim
|
kmod vim
|
||||||
|
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# i386-nlp doesn't have an npm version which supports ci
|
|
||||||
RUN if [ $ARCH = "i386-nlp" ]; then \
|
# We first ensure that every architecture has an npm version
|
||||||
JOBS=MAX npm install --no-optional --unsafe-perm; \
|
# which can do an npm ci, then we perform the ci using this
|
||||||
else \
|
# temporary version
|
||||||
JOBS=MAX npm ci --no-optional --unsafe-perm; \
|
RUN curl -LOJ https://www.npmjs.com/install.sh && \
|
||||||
fi
|
# This is required to avoid a bug in uid-number
|
||||||
|
# https://github.com/npm/uid-number/issues/7
|
||||||
|
npm config set unsafe-perm true && \
|
||||||
|
npm_install="${NPM_VERSION}" npm_config_prefix=/tmp sh ./install.sh && \
|
||||||
|
JOBS=MAX /tmp/bin/npm ci --no-optional --unsafe-perm
|
||||||
|
|
||||||
COPY src src/
|
COPY src src/
|
||||||
COPY typings typings/
|
COPY typings typings/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user