balena-supervisor/Dockerfile.debug
Cameron Diver 557f88965a 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>
2019-06-27 17:09:31 +01:00

82 lines
2.9 KiB
Docker

ARG ARCH=amd64
ARG NPM_VERSION=6.9.0
# The node version here should match the version of the runtime image which is
# specified in the base-image subdirectory in the project
FROM balenalib/raspberry-pi-node:10-run as rpi-base
FROM balenalib/armv7hf-node:10-run as armv7hf-base
FROM balenalib/aarch64-node:10-run as aarch64-base
RUN [ "cross-build-start" ]
RUN sed -i '/security.debian.org jessie/d' /etc/apt/sources.list
RUN [ "cross-build-end" ]
FROM balenalib/amd64-node:10-run as amd64-base
RUN echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-start && chmod +x /usr/bin/cross-build-start \
&& echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-end && chmod +x /usr/bin/cross-build-end
FROM balenalib/i386-node:10-run as i386-base
RUN echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-start && chmod +x /usr/bin/cross-build-start \
&& echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-end && chmod +x /usr/bin/cross-build-end
FROM resin/i386-node:6.13.1-slim as i386-nlp-base
RUN echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-start && chmod +x /usr/bin/cross-build-start \
&& echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-end && chmod +x /usr/bin/cross-build-end \
# TODO: Move this to a balenalib image so this isn't necessary
&& sed -i '/jessie-updates/{s/^/#/}' /etc/apt/sources.list
# A little hack to make this work with the makefile
FROM $ARCH-base AS node-build
FROM $ARCH-base AS node-deps
ARG ARCH
ARG VERSION=master
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
RUN [ "cross-build-start" ]
WORKDIR /usr/src/app
RUN apt-get update && apt-get install ca-certificates \
iptables libnss-mdns nodejs rsync git python make curl g++ \
kmod vim
COPY package*.json ./
# 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 src src/
COPY typings typings/
COPY tsconfig.json tsconfig.release.json hardcode-migrations.js fix-jsonstream.js ./
RUN npm run build:debug
RUN mkdir -p dist && echo "require('../build/app.js')" > dist/app.js
COPY entry.sh .
RUN mkdir -p rootfs-overlay && \
(([ ! -d rootfs-overlay/lib64 ] && ln -s /lib rootfs-overlay/lib64) || true)
ENV CONFIG_MOUNT_POINT=/boot/config.json \
LED_FILE=/dev/null \
SUPERVISOR_IMAGE=resin/$ARCH-supervisor \
VERSION=$VERSION \
DEFAULT_MIXPANEL_TOKEN=$DEFAULT_MIXPANEL_TOKEN
COPY avahi-daemon.conf /etc/avahi/avahi-daemon.conf
VOLUME /data
HEALTHCHECK --interval=5m --start-period=1m --timeout=30s --retries=3 \
CMD wget -qO- http://127.0.0.1:${LISTEN_PORT:-48484}/v1/healthy || exit 1
RUN [ "cross-build-end" ]
CMD DEBUG=1 ./entry.sh || while true; do echo 'Supervisor runtime exited - waiting for changes'; sleep 100; done;