Application code in all Clode containers is held within /root/app, therefore we have a default volume available to allow you to map this volume to existing code, or leave it how it is to start developing or loading code into that area.
Standardizing this is essential so we can run production code from there in a production container, mapping to this volume for an IDE container to allow you to edit application files, or defining it to be mapped to existing code on the host container for either function.
This is considered the primary volume that contains the files needed for the primary function of the container created.
START EXPERIMENTING WITH NODE
In this example we start working with REPL (Read–eval–print loop) which opens a node console that lets you start experimenting with code right away.
docker run -t -i clode/rpi-node node
START BUILDING A NEW APPLICATION
In this example we're dropped into a shell where the node command is available. Clone in a repository, or start writing code.
docker run -t -i clode/rpi-node /bin/bash
MAP TO AN EXISTING CODEBASE VOLUME
*In this example, another container's volume /root/app has your application code in it already and you want to use it.
Replace [CONTAINER_ID] with the ID of the container that has the existing volume. (Without Brackets)*
docker run -t -i --volumes-from=[CONTAINER_ID] clode/rpi-node /bin/bash
MAP TO AN EXISTING CODE BASE ON THE HOST
*In this example you wish to run/test/modify code that exists in a host folder.
Replace [/path/to/host/folder] with an existing folder on the host. (Without Brackets)*
docker run -t -i -v [/path/to/host/folder]:/root/app clode/rpi-node /bin/bash
RUN AN EXISTING NODE APPLICATION FROM A CODE BASE VOLUME IN THE BACKGROUND
*In this example, it assumes your node app isn't a web server, as it doesn't show you how to do port mapping. It's just a simple example on how to run a node app in the background.
Replace [yourapp.js] with the js file to run. (Without Brackets)*
docker run -t -d -i clode/rpi-node node [yourapp.js]
FROM clode/rpi-core RUN wget http://node-arm.herokuapp.com/node_latest_armhf.deb RUN dpkg -i node_latest_armhf.deb RUN mkdir /root/app WORKDIR /root/app VOLUME /root/app
This is not an introductory guide, it's only meant to be a base to provide node functionality to downstream containers, running node applications, or basic development / production environments.
On build, It pulls the latest pre-compiled version of node available
for the Raspberry Pi.