Skip to content

Instantly share code, notes, and snippets.

@zxkane
Forked from dceejay/Dockerfile
Last active October 8, 2017 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zxkane/162d0678de3186d26b4a to your computer and use it in GitHub Desktop.
Save zxkane/162d0678de3186d26b4a to your computer and use it in GitHub Desktop.
Run latest node-red on Ubuntu 14.04
# Dockerfile for Node-RED - pulls latest master code from git
FROM ubuntu:14.04
# based on the original by @cpswan
MAINTAINER ceejay kane
# add universe repository to /etc/apt/sources.list
# we need it later as rlwrap is required by node.js
#RUN sed -i s/main/'main universe'/ /etc/apt/sources.list
# make sure everything is up to date - update and upgrade
RUN apt-get update -y
# RUN apt-get upgrade -y
# install dependencies
#RUN apt-get install python-software-properties python g++ make software-properties-common wget curl unzip git -y
RUN apt-get install python-software-properties wget curl unzip git -y
# add node.js repo
RUN curl -sL https://deb.nodesource.com/setup | sudo bash -
# install node.js
RUN apt-get install nodejs -y
# download latest node-red
RUN cd /opt && git clone https://github.com/node-red/node-red.git
# remove some nodes
RUN cd /opt/node-red/nodes/core && rm -rf hardware deprecated
RUN cd /opt/node-red/nodes/core/io && rm -f 25-serial*
# install node-red node_modules
RUN cd /opt/node-red && npm install --production && npm install eyes js2xmlparser fs.notify
# add extra nodes project so we have the lot just in case.
#RUN cd /opt/node-red/nodes && git clone https://github.com/node-red/node-red-nodes.git
# expose port
EXPOSE 1880
# Set the default command to execute
# when creating a new container
CMD /usr/bin/node /opt/node-red/red.js -v flow.json

install docker

sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo reboot

then

sudo apt-get install lxc-docker

add yourself to docker group for when you get fed up with all the sudo below...

sudo groupadd docker
sudo gpasswd -a ${USER} docker
sudo service docker restart

install Node-RED from gist

sudo docker build --rm -t davecj/node-red http://gist.github.com/raw/9435867/Dockerfile
or
sudo docker build --rm -t davecj/node-red git://gist.github.com/9435867.git

(or scp Dockerfile and build)

sudo docker build --rm -t davecj/node-red - < Dockerfile

run (as daemon)

sudo docker run -d -p 1880:1880 davecj/node-red

command line

sudo docker run -i -t davecj/node-red /bin/bash

show running containers

sudo docker ps -a

show all images (so you can tidy up)

sudo docker images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment