2019-05-08 13:37:16 +00:00
|
|
|
ARG ARCH=amd64
|
2019-06-24 13:19:00 +00:00
|
|
|
ARG NPM_VERSION=6.9.0
|
2019-05-08 13:37:16 +00:00
|
|
|
|
|
|
|
# The node version here should match the version of the runtime image which is
|
|
|
|
# specified in the base-image subdirectory in the project
|
2019-07-19 17:03:47 +00:00
|
|
|
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
|
2019-05-08 13:37:16 +00:00
|
|
|
RUN [ "cross-build-start" ]
|
|
|
|
RUN sed -i '/security.debian.org jessie/d' /etc/apt/sources.list
|
|
|
|
RUN [ "cross-build-end" ]
|
|
|
|
|
2019-07-19 17:03:47 +00:00
|
|
|
FROM balenalib/amd64-node:10-run as amd64-node-base
|
2019-05-08 13:37:16 +00:00
|
|
|
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
|
|
|
|
|
2019-07-19 17:03:47 +00:00
|
|
|
FROM balenalib/i386-node:10-run as i386-node-base
|
2019-05-08 13:37:16 +00:00
|
|
|
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
|
|
|
|
|
2019-07-19 17:03:47 +00:00
|
|
|
FROM balenalib/i386-nlp-node:6-jessie as i386-nlp-node-base
|
2019-05-08 13:37:16 +00:00
|
|
|
RUN echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-start && chmod +x /usr/bin/cross-build-start \
|
2019-06-25 15:06:33 +00:00
|
|
|
&& echo '#!/bin/sh\nexit 0' > /usr/bin/cross-build-end && chmod +x /usr/bin/cross-build-end
|
2019-05-08 13:37:16 +00:00
|
|
|
|
2019-07-19 17:03:47 +00:00
|
|
|
FROM $ARCH-node-base AS node-deps
|
2019-05-08 13:37:16 +00:00
|
|
|
|
|
|
|
RUN [ "cross-build-start" ]
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
2019-07-19 17:03:47 +00:00
|
|
|
RUN apt-get update \
|
|
|
|
&& apt-get install -y \
|
|
|
|
ca-certificates \
|
|
|
|
g++ \
|
|
|
|
git \
|
|
|
|
kmod \
|
|
|
|
iptables \
|
|
|
|
libnss-mdns \
|
|
|
|
make \
|
|
|
|
nodejs \
|
|
|
|
python \
|
|
|
|
rsync \
|
|
|
|
curl \
|
|
|
|
vim
|
2019-05-08 13:37:16 +00:00
|
|
|
|
2019-06-24 13:19:00 +00:00
|
|
|
# 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 && \
|
2019-07-05 10:32:59 +00:00
|
|
|
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
|
2019-05-08 13:37:16 +00:00
|
|
|
|
|
|
|
COPY src src/
|
|
|
|
COPY typings typings/
|
2019-06-13 09:54:39 +00:00
|
|
|
COPY tsconfig.json tsconfig.release.json hardcode-migrations.js fix-jsonstream.js ./
|
2019-05-08 13:37:16 +00:00
|
|
|
|
|
|
|
RUN npm run build:debug
|
2019-05-15 11:37:38 +00:00
|
|
|
RUN mkdir -p dist && echo "require('../build/app.js')" > dist/app.js
|
2019-05-08 13:37:16 +00:00
|
|
|
|
|
|
|
COPY entry.sh .
|
|
|
|
|
2019-06-13 12:20:24 +00:00
|
|
|
RUN mkdir -p rootfs-overlay && \
|
|
|
|
(([ ! -d rootfs-overlay/lib64 ] && ln -s /lib rootfs-overlay/lib64) || true)
|
2019-05-08 13:37:16 +00:00
|
|
|
|
2019-07-19 15:54:06 +00:00
|
|
|
ARG ARCH
|
|
|
|
ARG VERSION=master
|
|
|
|
ARG DEFAULT_MIXPANEL_TOKEN=bananasbananas
|
2019-05-08 13:37:16 +00:00
|
|
|
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" ]
|
|
|
|
|
2019-05-29 11:44:48 +00:00
|
|
|
CMD DEBUG=1 ./entry.sh || while true; do echo 'Supervisor runtime exited - waiting for changes'; sleep 100; done;
|