Skip to content

Commit

Permalink
Update balenalib
Browse files Browse the repository at this point in the history
  • Loading branch information
dansku committed Apr 30, 2019
1 parent bff53a5 commit 10af09e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
24 changes: 11 additions & 13 deletions Dockerfile.template
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# base-image for node on any machine using a template variable,
# see more about dockerfile templates here: http://docs.resin.io/deployment/docker-templates/
# and about resin base images here: http://docs.resin.io/runtime/resin-base-images/
# see more about dockerfile templates here: https://www.balena.io/docs/learn/develop/dockerfile/
# and about balena base images here: https://www.balena.io/docs/reference/base-images/base-images/
# Note the node:slim image doesn't have node-gyp
FROM resin/%%RESIN_MACHINE_NAME%%-node:6
FROM balenalib/%%BALENA_MACHINE_NAME%%-node:9-stretch-build

# use apt-get if you need to install dependencies,
# for instance if you need ALSA sound utils, just uncomment the lines below.
#RUN apt-get update && apt-get install -yq \
# alsa-utils libasound2-dev && \
# apt-get clean && rm -rf /var/lib/apt/lists/*
# use `install_packages` if you need to install dependencies,
# # for instance if you need git, just uncomment the line below.
# # RUN install_packages git

# Defines our working directory in container
WORKDIR /usr/src/app

# Copies the package.json first for better cache on later pushes
COPY package.json package.json

# This install npm dependencies on the resin.io build server,
# making sure to clean up the artifacts it creates in order to reduce the image size.
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache clean && rm -rf /tmp/*
# This install npm dependencies on the balena build server,
# # making sure to clean up the artifacts it creates in order to reduce the image size.
RUN JOBS=MAX npm install --production --unsafe-perm && npm cache verify && rm -rf /tmp/

# This will copy all files in our root to the working directory in the container
COPY . ./

# Enable systemd init system in container
ENV INITSYSTEM on
# Enable udevd so that plugged dynamic hardware devices show up in our container.
ENV UDEV=1

# server.js will run when container starts up on the device
CMD ["npm", "start"]
6 changes: 4 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
console.log('Starting');

var ledToggle, pressCount;
//provision the gpio pins 22 for the led output and 17 for the button input
var led= require("pi-pins").connect(22),
var led = require("pi-pins").connect(22),
button = require("pi-pins").connect(17);

//set the pin mode, setting pin 22 as an output and 17 as an input
button.mode('in');
led.mode('out');

//set the initial value of the LED to be off.
//set the initial value of the LED to be on.
ledToggle = false;
pressCount= 0;
led.value(true);
Expand Down

0 comments on commit 10af09e

Please sign in to comment.