mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-24 07:46:41 +00:00
34983651d0
Change-type: patch
88 lines
2.8 KiB
Docker
88 lines
2.8 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-node-base
|
|
FROM balenalib/armv7hf-node:10-run as armv7hf-node-base
|
|
FROM balenalib/aarch64-node:10-run as aarch64-node-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-node-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-node-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-nlp-node:6-jessie as i386-nlp-node-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 $ARCH-node-base AS node-deps
|
|
|
|
RUN [ "cross-build-start" ]
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y \
|
|
ca-certificates \
|
|
g++ \
|
|
git \
|
|
kmod \
|
|
iptables \
|
|
libnss-mdns \
|
|
make \
|
|
nodejs \
|
|
python \
|
|
rsync \
|
|
curl \
|
|
vim
|
|
|
|
ARG 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
|
|
# 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
|
|
|
|
COPY package*.json ./
|
|
RUN 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)
|
|
|
|
ARG ARCH
|
|
ARG VERSION=master
|
|
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
|
|
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;
|