[DOCKER] Repository structure for one-touch build of Node-RED container

Node-RED Advent Caldendar 2020 This is an article on 12/18.

What are you doing with Node-RED flow management? I recently started to manage flow files with git.

@ high-u Node-RED Advent Caldendar 2018 article: Are you using git with Node-RED?

And with the intention of setting up a verification environment with the same quality every time, I'm already doing it! I'm sure there are people who say that, but I'm going to summarize it lightly.

Preparing the Git repository

I have two repositories. You can put Flow in one repository, but this time it is a derivative version of TJBot, a robot learning kit that runs on Node-RED, Virtual TJBot Project, and runs locally Virtual TJBot-starter- container is introduced as a sample.

repository Explanation
https://github.com/tjbotfan/virtual-tjbot-handson/ Node-RED project repository
https://github.com/tjbotfan/virtual-tjbot-starter-container Repository with DockerFile

Preparing the repository with DockerFile

In https://github.com/tjbotfan/virtual-tjbot-starter-container, in addition to DockerFile, the git submodule links the repository of the Node-RED project.

By making it a submodule, when you git clone it, the contents will be downloaded together, but It is convenient that it is not affected in the submodule at the time of git checkout. (The Node-RED flow is a separate project and management is separate)

When you bring the repository with the Submodule

$ git clone --recursive  https://github.com/tjbotfan/virtual-tjbot-starter-container

will do.

The repository after acquisition is as follows.

$ cd virtual-tjbot-starter-container/
$ ls -lR
.:
8 in total
-rw-rw-r--1 phadmin phadmin 1069 December 23 02:17 Dockerfile
-rw-rw-r--1 phadmin phadmin 196 December 23 02:17 README.md
drwxrwxr-x 2 phadmin phadmin 112 December 23 02:18 node-red-settings

./node-red-settings:
44 in total
-rw-rw-r--1 phadmin phadmin 228 December 23 02:18 README.md
-rw-rw-r--1 phadmin phadmin 29165 December 23 02:18 flow.json
-rw-rw-r--1 phadmin phadmin 1 December 23 02:18 flow_cred.json
-rw-rw-r--1 phadmin phadmin 1087 December 23 02:18 package.json

After that, by writing in the Dockerfile to copy flow.json using COPY on the Dockerfile, Every time you build docker, the container will bring you a Flow from the Node-RED repository.

at the end

It was more of a container than Node-RED, By making the Node-RED flow into a project, it is easy to manage the version and it can be conveniently used even when containerizing. I wrote it by saying that I don't see a cohesive article.

I'd like to say that I'd like to be able to refer to it as a Node-RED project even from Node-RED started in the container. I would like to take on these challenges.

Recommended Posts

Repository structure for one-touch build of Node-RED container
Build a container for Docker x Laravel phpMyAdmin
Build a docker container for a python simple web server
Measures for insufficient memory capacity of docker compose build