From d425aec2e4e325cfd044a904e1437cf0a27fac7c Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Sat, 26 Jan 2019 21:57:06 +0100 Subject: [PATCH 1/2] Set up ARM build --- .travis.yml | 14 +++++++++++--- Dockerfile-raspberrypi3 | 23 +++++++++++++++++++++++ docker-compose-raspberrypi3.yml | 17 +++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 Dockerfile-raspberrypi3 create mode 100644 docker-compose-raspberrypi3.yml diff --git a/.travis.yml b/.travis.yml index 40ac718..530ffa1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,16 @@ services: - docker before_script: - npm run build -- docker build -t cbase/infoscreens:latest . -- docker tag cbase/infoscreens:latest "cbase/infoscreens:${TRAVIS_BUILD_NUMBER}" +# Prepare cross-compiling environment if targeting ARM +- if [ "$TARGET" == "raspberrypi3" ]; then docker run --rm --privileged multiarch/qemu-user-static:register --reset; fi +# Build the Docker image +- docker build -t "${DOCKER_IMAGE}:latest" -f $DOCKER_FILE . +- docker tag "${DOCKER_IMAGE}:latest" "${DOCKER_IMAGE}:${TRAVIS_BUILD_NUMBER}" - docker-compose up -d - docker-compose ps deploy: - provider: script - script: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker push "cbase/infoscreens:latest" && docker push "cbase/infoscreens:${TRAVIS_BUILD_NUMBER}" + script: docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker push "${DOCKER_IMAGE}:latest" && docker push "${DOCKER_IMAGE}:${TRAVIS_BUILD_NUMBER}" on: branch: master repo: c-base/infoscreens @@ -19,3 +22,8 @@ env: global: - secure: R0ZZ7VmLdTbVtFqB36KtxSn5S1noZH0D577atVfW+CSL35QLcyofoFo9xg223T51yZJyZMFOvxLuD7LZDL4FSBdoC6jfHQ7sluu/ZOCGEfKhxunjzhOjdIlL/zX7iBk03u5QI6qah+iIOohoqb0294qyNRQWa57Ut5lkeqJnsD9fsXrn0eqcC+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05gLKEx3jHqIawtSjPQVY8XZiWnPtmO5yIP4RNQniP43Oaf/0mW7up1+ZjN+/jx0reuhR33+EkCCEmzhB+p1P9LxEXnRpr1RF8p1y47b/JXfEqw= +matrix: + include: + - env: TARGET=x86 DOCKER_IMAGE=cbase/infoscreens COMPOSE_FILE=docker-compose.yml DOCKER_FILE=Dockerfile + - env: TARGET=raspberrypi3 DOCKER_IMAGE=cbase/raspberrypi3-infoscreens COMPOSE_FILE=docker-compose-raspberrypi3.yml DOCKER_FILE=Dockerfile-raspberrypi3 + sudo: true diff --git a/Dockerfile-raspberrypi3 b/Dockerfile-raspberrypi3 new file mode 100644 index 0000000..21e6771 --- /dev/null +++ b/Dockerfile-raspberrypi3 @@ -0,0 +1,23 @@ +FROM resin/raspberrypi3-node:8 + +# Reduce npm install verbosity, overflows Travis CI log view +ENV NPM_CONFIG_LOGLEVEL warn +ENV NODE_ENV production + +EXPOSE 8080 + +RUN mkdir -p /var/infoscreens +WORKDIR /var/infoscreens +COPY package.json /var/infoscreens +COPY server /var/infoscreens/server +COPY dist /var/infoscreens/dist + +# Install NoFlo and dependencies +RUN npm install --only=production + +# Map the volumes +VOLUME /var/infoscreens/dist +VOLUME /var/infoscreens/videos +VOLUME /var/infoscreens/pictures + +CMD npm start diff --git a/docker-compose-raspberrypi3.yml b/docker-compose-raspberrypi3.yml new file mode 100644 index 0000000..0cfb577 --- /dev/null +++ b/docker-compose-raspberrypi3.yml @@ -0,0 +1,17 @@ +version: '2' +services: + mqtt-infoscreens: + image: ansi/raspberrypi3-mosquitto + ports: + - '1882:9001' + - '1883:1883' + infoscreens: + image: cbase/raspberrypi3-infoscreens + ports: + - '8080:8080' + links: + - mqtt-infoscreens + volumes: + - ./dist:/var/infoscreens/dist + - ./videos:/var/infoscreens/videos + - ./pictures:/var/infoscreens/pictures From 1069f813603b3c2125167280099b99db66937223 Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Sat, 26 Jan 2019 22:00:53 +0100 Subject: [PATCH 2/2] Run linter as tests --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7c9451f..deaf4c4 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "main": "index.js", "scripts": { "build": "webpack", - "pretest": "eslint index.js lib/*.js elements/*.js infodisplay/*.js events/*.js", + "lint": "eslint index.js lib/*.js elements/*.js infodisplay/*.js events/*.js", "dev": "webpack-dev-server", "start": "node server", - "test": "npm run build" + "test": "npm run lint" }, "author": "Henri Bergius ", "license": "MIT",