-
-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathDockerfile
68 lines (50 loc) · 1.46 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
# STEP: 1 doens't work with alpine 3.13+
FROM node:16.3.0-alpine3.12 AS build-z2m
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
COPY . .
RUN yarn run build && \
yarn remove $(cat package.json | jq -r '.devDependencies | keys | join(" ")') && \
rm -rf \
build \
package.sh \
src \
static \
docs \
.yarn
# 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) doens't work with alpine 3.13+
FROM node:16.3.0-alpine3.12
RUN apk add --no-cache \
libstdc++ \
openssl \
libgcc \
libusb \
tzdata \
eudev
# Copy files from previous build stage
COPY --from=build-z2m /usr/src/app /usr/src/app
ENV ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
WORKDIR /usr/src/app
EXPOSE 8091
CMD ["node", "server/bin/www"]