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-05-09 11:15:47 +00:00
|
|
|
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
|
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-05-09 11:15:47 +00:00
|
|
|
FROM balenalib/amd64-node:10-run as amd64-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-05-14 12:01:16 +00:00
|
|
|
FROM balenalib/i386-node:10-run as i386-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-06-25 15:06:33 +00:00
|
|
|
FROM balenalib/i386-nlp-node:6-jessie as i386-nlp-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
|
|
|
|
|
|
|
# A little hack to make this work with the makefile
|
|
|
|
FROM $ARCH-base AS node-build
|
|
|
|
FROM $ARCH-base AS node-deps
|
|
|
|
|
2019-05-15 09:45:36 +00:00
|
|
|
ARG ARCH
|
2019-05-08 13:37:16 +00:00
|
|
|
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 \
|
2019-06-24 13:19:00 +00:00
|
|
|
iptables libnss-mdns nodejs rsync git python make curl g++ \
|
2019-05-15 11:37:38 +00:00
|
|
|
kmod vim
|
2019-05-08 13:37:16 +00:00
|
|
|
|
|
|
|
COPY package*.json ./
|
|
|
|
|
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 && \
|
|
|
|
npm_install="${NPM_VERSION}" npm_config_prefix=/tmp sh ./install.sh && \
|
|
|
|
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
|
|
|
|
|
|
|
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;
|