-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
52 lines (38 loc) · 1.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM mhart/alpine-node:6 AS build
# python addition to alpine node
RUN apk add --no-cache --virtual .gyp \
python \
make \
g++
WORKDIR /app
# package.json contains Node-RED NPM module and node dependencies
COPY package.json ./
COPY /dev ./keys/dev
COPY /prod ./keys/prod
RUN npm install
FROM mhart/alpine-node:6 AS release
# Home directory for Node-RED application source code.
RUN mkdir -p /usr/src/node-red
# User data directory, contains flows, config and nodes.
RUN mkdir /data
WORKDIR /usr/src/node-red
RUN mkdir openLV
# Add node-red user so we aren't running as root.
RUN adduser -h /usr/src/node-red -D -H node-red \
&& chown -R node-red:node-red /data \
&& chown -R node-red:node-red /usr/src/node-red
USER node-red
# openLV source code
COPY index.js .
COPY /openLV ./openLV
# Only copy over the functional pieces to a clean image
COPY --from=build /app .
# User configuration directory volume
VOLUME ["/data"]
EXPOSE 1880
# Environment variable holding file path for flows configuration
ENV FLOWS=flows.json
# USER root
# RUN npm install -g lv-cap
USER node-red
CMD ["node", "index.js"]