forked from binnes/Node-RED-Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
52 lines (35 loc) · 1.06 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 node:lts as build
RUN apt-get update \
&& apt-get install -y build-essential python perl-modules
RUN deluser --remove-home node \
&& groupadd --gid 1000 nodered \
&& useradd --gid nodered --uid 1000 --shell /bin/bash --create-home nodered
RUN mkdir -p /data && chown 1000 /data
USER 1000
WORKDIR /data
COPY ./package.json /data/
RUN npm install
## Release image
FROM node:lts-slim
RUN apt-get update && apt-get install -y perl-modules && rm -rf /var/lib/apt/lists/*
RUN deluser --remove-home node \
&& groupadd --gid 1000 nodered \
&& useradd --gid nodered --uid 1000 --shell /bin/bash --create-home nodered
RUN mkdir -p /data && chown 1000 /data
USER 1000
COPY ./server.js /data/
COPY ./settings.js /data/
COPY ./flows.json /data/
COPY ./flows_cred.json /data/
COPY ./package.json /data/
COPY --from=build /data/node_modules /data/node_modules
USER 0
RUN chgrp -R 0 /data \
&& chmod -R g=u /data
USER 1000
WORKDIR /data
ENV PORT 1880
ENV NODE_ENV=production
ENV NODE_PATH=/data/node_modules
EXPOSE 1880
CMD ["node", "/data/server.js", "/data/flows.json"]