Skip to content

Commit 400cb4f

Browse files
authoredNov 27, 2023
fix(docker): try using custom alpine (#3443)
1 parent 46773f7 commit 400cb4f

File tree

8 files changed

+1174
-1262
lines changed

8 files changed

+1174
-1262
lines changed
 

‎api/lib/ZwaveClient.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6023,8 +6023,8 @@ class ZwaveClient extends TypedEventEmitter<ZwaveClientEventCallbacks> {
60236023
zwaveValueMeta.type === 'number'
60246024
? parseInt(k)
60256025
: zwaveValueMeta.type === 'boolean'
6026-
? k === 'true'
6027-
: k,
6026+
? k === 'true'
6027+
: k,
60286028
})
60296029
}
60306030
} else {

‎api/lib/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export type DeepPartial<T> = {
1919
[P in keyof T]?: T[P] extends Array<infer U>
2020
? Array<DeepPartial<U>>
2121
: T[P] extends ReadonlyArray<infer U>
22-
? ReadonlyArray<DeepPartial<U>>
23-
: DeepPartial<T[P]>
22+
? ReadonlyArray<DeepPartial<U>>
23+
: DeepPartial<T[P]>
2424
}
2525

2626
export interface ErrnoException extends Error {

‎docker/Dockerfile

+30-19
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
ARG image=zwave-js-ui
22

3-
# STEP: 1 build
4-
FROM node:20.10.0-bookworm AS build-zui
3+
FROM alpine:3.18.4 as base
54

6-
WORKDIR /usr/src/app
5+
RUN apk add --no-cache \
6+
openssl \
7+
libusb \
8+
tzdata \
9+
eudev \
10+
nodejs=18.18.2-r0
711

8-
RUN apt-get update && apt-get install -y \
9-
jq \
10-
python3 \
11-
&& rm -rf /var/lib/apt/lists/*
12+
WORKDIR /usr/src/app
1213

13-
COPY package.json yarn.lock .yarnrc.yml ./
14-
COPY .yarn/releases .yarn/releases
14+
# STEP: 1 build
15+
FROM base AS build-zui
16+
17+
RUN \
18+
apk add --no-cache --virtual .build-dependencies \
19+
jq \
20+
build-base \
21+
linux-headers \
22+
python3-dev \
23+
npm=9.6.6-r0 \
24+
\
25+
&& npm install --global yarn
1526

1627
ENV YARN_HTTP_TIMEOUT=300000
1728
# set production env install will not install devDependencies
@@ -26,15 +37,19 @@ RUN [ -d 'node_modules' ] && echo "Skipping install" || yarn install --immutable
2637
RUN npm_config_build_from_source=true npm rebuild @serialport/bindings-cpp
2738

2839
# Build back and frontend only when not existing
29-
RUN [ -d 'dist' ] && echo "Skipping build" || yarn build
40+
RUN [ -d 'dist' ] && echo "Skipping build" || npm run build
3041

31-
RUN yarn remove $(cat package.json | jq -r '.devDependencies | keys | join(" ")') && \
42+
RUN npm prune --production && \
3243
rm -rf \
44+
package-lock.json \
3345
build \
3446
package.sh \
3547
src \
48+
api \
3649
static \
3750
docs \
51+
kubernetes \
52+
test \
3853
.yarn \
3954
.github \
4055
.vscode
@@ -54,14 +69,12 @@ RUN if [ ! -z "$updateDevices" ]; \
5469
node-zwave-js-master/packages/config/config/devices/ ;\
5570
fi
5671

57-
# STEP: 2 (runtime)
58-
FROM node:20.10.0-bookworm-slim
72+
RUN apk del --no-cache --purge .build-dependencies
5973

60-
RUN apt-get update && apt-get install -y \
61-
openssl \
62-
&& rm -rf /var/lib/apt/lists/*
74+
# STEP: 2 (runtime)
75+
FROM base AS runtime
6376

64-
# Copy files from the previous build stage
77+
# Copy files from previous build stage
6578
COPY --from=build-zui /usr/src/app /usr/src/app
6679

6780
ENV ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db
@@ -70,8 +83,6 @@ ENV TAG_NAME=${image_name}
7083

7184
ENV NODE_ENV=production
7285

73-
WORKDIR /usr/src/app
74-
7586
EXPOSE 8091
7687

7788
CMD ["node", "server/bin/www"]

‎docker/Dockerfile.alpine ‎docker/Dockerfile.debian

+8-17
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
ARG image=zwave-js-ui
22

33
# STEP: 1 build
4-
FROM node:20.10.0-alpine3.18 AS build-zui
4+
FROM node:20.10.0-bookworm AS build-zui
55

66
WORKDIR /usr/src/app
77

8-
RUN apk --no-cache add \
9-
coreutils \
8+
RUN apt-get update && apt-get install -y \
109
jq \
11-
linux-headers \
12-
alpine-sdk \
13-
python3
10+
python3 \
11+
&& rm -rf /var/lib/apt/lists/*
1412

1513
COPY package.json yarn.lock .yarnrc.yml ./
1614
COPY .yarn/releases .yarn/releases
@@ -19,8 +17,6 @@ ENV YARN_HTTP_TIMEOUT=300000
1917
# set production env install will not install devDependencies
2018
ENV NODE_ENV=production
2119

22-
ENV NODE_OPTIONS="--max-old-space-size=4096"
23-
2420
COPY . .
2521

2622
# if node_modules does not exist, run it, otherwise skip
@@ -59,18 +55,13 @@ RUN if [ ! -z "$updateDevices" ]; \
5955
fi
6056

6157
# STEP: 2 (runtime)
62-
FROM node:20.10.0-alpine3.18
58+
FROM node:20.10.0-bookworm-slim
6359

64-
RUN apk add --no-cache \
65-
libstdc++ \
60+
RUN apt-get update && apt-get install -y \
6661
openssl \
67-
libgcc \
68-
libusb \
69-
tzdata \
70-
eudev
71-
62+
&& rm -rf /var/lib/apt/lists/*
7263

73-
# Copy files from previous build stage
64+
# Copy files from the previous build stage
7465
COPY --from=build-zui /usr/src/app /usr/src/app
7566

7667
ENV ZWAVEJS_EXTERNAL_CONFIG=/usr/src/app/store/.config-db

‎src/components/ValueId.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@
165165
'max-width': $vuetify.breakpoint.smAndDown
166166
? '280px'
167167
: $vuetify.breakpoint.smOnly
168-
? '400px'
169-
: 'auto',
168+
? '400px'
169+
: 'auto',
170170
}"
171171
:hint="help"
172172
persistent-hint
@@ -197,8 +197,8 @@
197197
'max-width': $vuetify.breakpoint.smAndDown
198198
? '280px'
199199
: $vuetify.breakpoint.smOnly
200-
? '400px'
201-
: 'auto',
200+
? '400px'
201+
: 'auto',
202202
}"
203203
:hint="help"
204204
persistent-hint

‎src/components/nodes-table/nodes-table.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ export default {
245245
value === undefined
246246
? valueMap.default
247247
: value
248-
? valueMap.true
249-
: valueMap.false
248+
? valueMap.true
249+
: valueMap.false
250250
return {
251251
align: 'center',
252252
icon: map.icon,

‎src/modules/Settings.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export class Settings {
2323
valStr === 'false'
2424
? false
2525
: valStr === 'true'
26-
? true
27-
: defaultVal
26+
? true
27+
: defaultVal
2828
break
2929
case 'number':
3030
val = valStr && !isNaN(valStr) ? Number(valStr) : defaultVal

‎yarn.lock

+1,124-1,214
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.