# base-image for node on any machine using a template variable,
# see more about dockerfile templates here:http://docs.resin.io/pages/deployment/docker-templates
# Note the node:slim image doesn't have node-gyp
FROM resin/%%RESIN_MACHINE_NAME%%-node:6-slim
# Define working directory in container
RUN mkdir -p /usr/src/app/
WORKDIR /usr/src/app
RUN apt-get update && apt-get install -y \
cmake \
make \
gcc \
g++ \
git \
python \
python-dev \
python-pip \
wget \
curl \
libevent-dev \
libpthread-stubs0-dev
RUN pip install requests spidev RPi.GPIO
RUN JOBS=MAX npm install -g \
node-red \
node-red-contrib-cpu \
node-red-contrib-persist \
node-red-contrib-ipc \
node-red-contrib-boolean-logic \
node-red-contrib-resinio \
node-red-contrib-aws-iot-hub \
node-red-dashboard \
node-red-node-smooth \
node-red-contrib-statistics \
node-red-contrib-cron \
node-red-contrib-msg-queue \
--production
RUN npm cache clean --force && rm -rf /tmp/*
# Set timezone
ENV TZ=CET
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# This will copy all files in our root to the working directory in the container
COPY ./app ./
# Enable systemd init system in container
ENV INITSYSTEM=on
# server.js will run when container starts up on the device
CMD ["bash", "/usr/src/app/start.sh"]