FROM balenalib/%%BALENA_MACHINE_NAME%%-node:10-build as build # Move to app dir WORKDIR /usr/src/app RUN apt-get update && apt-get install -y --no-install-recommends \ apt-utils \ clang \ libxcb-image0 \ libxcb-util0 \ xdg-utils \ libdbus-1-dev \ dbus-x11 \ libgtk2.0-dev \ libnotify-dev \ libgnome-keyring-dev \ libgconf2-dev \ libasound2-dev \ libcap-dev \ libcups2-dev \ libxtst-dev \ libxss1 \ libnss3-dev \ libsmbclient \ libssh-4 \ libexpat-dev # Move package.json to filesystem COPY ./app/package.json . # Install npm modules for the application RUN JOBS=MAX npm install --unsafe-perm --production \ && node_modules/.bin/electron-rebuild FROM balenalib/%%BALENA_MACHINE_NAME%%-node:10-run # Move to app dir WORKDIR /usr/src/app # Install runtime dependencies RUN install_packages \ xserver-xorg-core \ xserver-xorg-input-all \ xserver-xorg-video-fbdev \ xserver-xorg-input-evdev \ xorg \ xinput \ libxcb-image0 \ libxcb-util0 \ xdg-utils \ libdbus-1-3 \ dbus-x11 \ libgtk2.0 \ libnotify4 \ libgnome-keyring0 \ libgconf-2-4 \ libasound2 \ libcap2 \ libcups2 \ libxtst6 \ libxss1 \ libnss3 \ libsmbclient \ libssh-4 \ fbset \ libexpat1 # Install Systemd ENV container docker RUN apt-get update && apt-get install -y --no-install-recommends \ systemd \ && rm -rf /var/lib/apt/lists/* # We never want these to run in a container # Feel free to edit the list but this is the one we used RUN systemctl mask \ dev-hugepages.mount \ sys-fs-fuse-connections.mount \ sys-kernel-config.mount \ display-manager.service \ getty@.service \ systemd-logind.service \ systemd-remount-fs.service \ getty.target \ graphical.target COPY entry.sh /usr/bin/entry.sh COPY resin.service /etc/systemd/system/resin.service RUN systemctl enable /etc/systemd/system/resin.service STOPSIGNAL 37 VOLUME ["/sys/fs/cgroup"] ENTRYPOINT ["/usr/bin/entry.sh"] RUN echo "#!/bin/bash" > /etc/X11/xinit/xserverrc \ && echo "" >> /etc/X11/xinit/xserverrc \ && echo 'exec /usr/bin/X -s 0 dpms -nolisten tcp "$@"' >> /etc/X11/xinit/xserverrc # Move app to filesystem COPY ./app ./ # Copy the modules from the build step COPY --from=build /usr/src/app/node_modules ./node_modules # Build distributions RUN JOBS=MAX npm run build # Start app CMD ["bash", "/usr/src/app/start.sh"]