-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from brunoamaral/docker
Install Node-Red with docker and dependencies
- Loading branch information
Showing
4,495 changed files
with
8,609 additions
and
588,556 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
ARG ARCH=amd64 | ||
ARG NODE_VERSION=12 | ||
ARG OS=buster-slim | ||
|
||
#### Stage BASE ######################################################################################################## | ||
FROM ${ARCH}/node:${NODE_VERSION}-${OS} AS base | ||
|
||
# Copy scripts | ||
COPY scripts/*.sh /tmp/ | ||
|
||
# Install tools, create Node-RED app and data dir, add user and set rights | ||
RUN set -ex && \ | ||
apt-get update && apt-get install -y \ | ||
bash \ | ||
tzdata \ | ||
curl \ | ||
nano \ | ||
wget \ | ||
git \ | ||
openssl \ | ||
openssh-client \ | ||
ca-certificates && \ | ||
mkdir -p /usr/src/node-red /data && \ | ||
deluser --remove-home node && \ | ||
# adduser --home /usr/src/node-red --disabled-password --no-create-home node-red --uid 1000 && \ | ||
useradd --home-dir /usr/src/node-red --uid 1000 node-red && \ | ||
chown -R node-red:root /data && chmod -R g+rwX /data && \ | ||
chown -R node-red:root /usr/src/node-red && chmod -R g+rwX /usr/src/node-red | ||
# chown -R node-red:node-red /data && \ | ||
# chown -R node-red:node-red /usr/src/node-red | ||
|
||
# Set work directory | ||
WORKDIR /usr/src/node-red | ||
|
||
# Setup SSH known_hosts file | ||
COPY known_hosts.sh . | ||
RUN ./known_hosts.sh /etc/ssh/ssh_known_hosts && rm /usr/src/node-red/known_hosts.sh | ||
|
||
# package.json contains Node-RED NPM module and node dependencies | ||
COPY package.json . | ||
COPY flows.json /data/ | ||
COPY /python-ml /python-ml | ||
RUN chown -R node-red:root /python-ml | ||
|
||
#### Stage BUILD ####################################################################################################### | ||
FROM base AS build | ||
|
||
# Install Build tools | ||
RUN apt-get update && apt-get install -y build-essential python && \ | ||
npm install --unsafe-perm --no-update-notifier --no-fund --only=production && \ | ||
npm uninstall node-red-node-gpio && \ | ||
cp -R node_modules prod_node_modules | ||
|
||
#### Stage RELEASE ##################################################################################################### | ||
FROM base AS RELEASE | ||
ARG BUILD_DATE | ||
ARG BUILD_VERSION | ||
ARG BUILD_REF | ||
ARG NODE_RED_VERSION | ||
ARG ARCH | ||
ARG TAG_SUFFIX=default | ||
|
||
LABEL org.label-schema.build-date=${BUILD_DATE} \ | ||
org.label-schema.docker.dockerfile=".docker/Dockerfile.debian" \ | ||
org.label-schema.license="Apache-2.0" \ | ||
org.label-schema.name="Node-RED" \ | ||
org.label-schema.version=${BUILD_VERSION} \ | ||
org.label-schema.description="Low-code programming for event-driven applications." \ | ||
org.label-schema.url="https://nodered.org" \ | ||
org.label-schema.vcs-ref=${BUILD_REF} \ | ||
org.label-schema.vcs-type="Git" \ | ||
org.label-schema.vcs-url="https://github.com/node-red/node-red-docker" \ | ||
org.label-schema.arch=${ARCH} \ | ||
authors="Dave Conway-Jones, Nick O'Leary, James Thomas, Raymond Mouthaan" | ||
|
||
COPY --from=build /usr/src/node-red/prod_node_modules ./node_modules | ||
|
||
# Chown, install devtools & Clean up | ||
RUN chown -R node-red:root /usr/src/node-red && \ | ||
apt-get update && apt-get install -y build-essential python3-dev python3 \ | ||
python3-pip python3-numpy python3-pandas python3-h5py && \ | ||
pip3 install scikit-learn tensorflow && \ | ||
rm -r /tmp/* | ||
RUN pip3 install -r /python-ml/requirements.txt | ||
|
||
USER node-red | ||
|
||
# Install Gregory Nodes | ||
RUN npm install node-red-contrib-cheerio && \ | ||
npm install node-red-contrib-moment && \ | ||
npm install node-red-contrib-sqlstring && \ | ||
npm install node-red-dashboard && \ | ||
npm install node-red-node-feedparser && \ | ||
npm install node-red-node-sqlite && \ | ||
npm install node-red-node-ui-list | ||
|
||
|
||
# Env variables | ||
ENV NODE_RED_VERSION=$NODE_RED_VERSION \ | ||
NODE_PATH=/usr/src/node-red/node_modules:/data/node_modules \ | ||
PATH=/usr/src/node-red/node_modules/.bin:${PATH} \ | ||
FLOWS=flows.json | ||
|
||
# ENV NODE_RED_ENABLE_SAFE_MODE=true # Uncomment to enable safe start mode (flows not running) | ||
# ENV NODE_RED_ENABLE_PROJECTS=true # Uncomment to enable projects option | ||
|
||
# Saving for future reference in case we have trouble with copying python scripts and flows to the container | ||
# COPY --from=base /python-ml /python-ml | ||
# COPY --from=base /data/flows.json /data/flows.json | ||
|
||
# Expose the listening port of node-red | ||
EXPOSE 1880 | ||
|
||
# Add a healthcheck (default every 30 secs) | ||
# HEALTHCHECK CMD curl http://localhost:1880/ || exit 1 | ||
|
||
ENTRYPOINT ["npm", "start", "--cache", "/data/.npm", "--", "--userDir", "/data"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.