-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathDockerfile
79 lines (57 loc) · 1.66 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
ARG image=zwave-js-ui
# STEP: 1 build
FROM node:18.10.0-alpine3.16 AS build-zui
WORKDIR /usr/src/app
RUN apk --no-cache add \
coreutils \
jq \
linux-headers \
alpine-sdk \
python3
COPY package.json yarn.lock .yarnrc.yml ./
COPY .yarn/releases .yarn/releases
ENV YARN_HTTP_TIMEOUT=300000
RUN yarn install --immutable
# Fix issue with serialport bindings #2349
RUN npm_config_build_from_source=true yarn rebuild @serialport/bindings-cpp
COPY . .
# Build back and frontend only when not existing
RUN [ ! -d 'dist' ] && yarn run build
RUN yarn remove $(cat package.json | jq -r '.devDependencies | keys | join(" ")') && \
rm -rf \
build \
package.sh \
src \
static \
docs \
.yarn \
.github \
.vscode
# add plugin support, space separated
ARG plugins
RUN if [ ! -z "$plugins" ]; \
then echo "Installing plugins ${plugins}"; yarn add ${plugins} ; fi
# when update devices arg is set update config files from zwavejs repo
ARG updateDevices
ARG zwavejs=https://github.com/zwave-js/node-zwave-js/archive/master.tar.gz
RUN if [ ! -z "$updateDevices" ]; \
then curl -sL ${zwavejs} | \
tar vxz --strip=5 -C ./node_modules/@zwave-js/config/config/devices \
node-zwave-js-master/packages/config/config/devices/ ;\
fi
# STEP: 2 (runtime)
FROM node:18.10.0-alpine3.16
RUN apk add --no-cache \
libstdc++ \
openssl \
libgcc \
libusb \
tzdata \
eudev
# Copy files from previous build stage
COPY --from=build-zui /usr/src/app /usr/src/app
ENV ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
ENV TAG_NAME=${image_name}
WORKDIR /usr/src/app
EXPOSE 8091
CMD ["node", "server/bin/www"]