Skip to content

Commit 3e101dd

Browse files
committed
Revert "TEMP: revert for Koenkk/zigbee2mqtt#15856"
This reverts commit 2ca4dc9.
1 parent 2ca4dc9 commit 3e101dd

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

common/Dockerfile

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
ARG BUILD_FROM
2-
FROM $BUILD_FROM
2+
FROM $BUILD_FROM as base
33

44
ENV LANG C.UTF-8
55
ARG BUILD_VERSION
66

7-
RUN apk add --no-cache --virtual .build-dependencies make gcc g++ linux-headers udev git python3 && \
8-
apk add --no-cache nodejs npm socat tini && \
7+
RUN apk add --no-cache socat tini nodejs
8+
9+
# Dependencies and build
10+
FROM base as dependencies_and_build
11+
12+
RUN apk add --no-cache --virtual .buildtools npm make gcc g++ linux-headers udev git python3 && \
913
if [ "${BUILD_VERSION}" = "edge" ]; \
1014
then \
1115
echo "Installing Edge version" && \
@@ -27,12 +31,20 @@ RUN apk add --no-cache --virtual .build-dependencies make gcc g++ linux-headers
2731
npm ci --no-audit --no-optional --no-update-notifier --unsafe-perm && \
2832
npm run build && \
2933
rm -rf node_modules && \
30-
npm ci --no-audit --no-optional --no-update-notifier --only=production --unsafe-perm && \
31-
apk del --no-cache --purge .build-dependencies && \
32-
rm -rf docs test images data docker LICENSE README.md update.sh lib && \
33-
rm -rf /root/.cache /root/.npm
34+
npm ci --no-audit --no-optional --no-update-notifier --production --unsafe-perm && \
35+
# Serialport needs to be rebuild for Alpine https://serialport.io/docs/9.x.x/guide-installation#alpine-linux
36+
npm rebuild --build-from-source && \
37+
apk del .buildtools
38+
39+
# Release
40+
FROM base as release
41+
42+
WORKDIR /app
3443

3544
COPY rootfs /
45+
COPY --from=dependencies_and_build /app/node_modules ./node_modules
46+
COPY --from=dependencies_and_build /app/dist ./dist
47+
COPY --from=dependencies_and_build /app/package.json /app/LICENSE /app/index.js ./
3648

3749
ENV NODE_ENV production
3850

0 commit comments

Comments
 (0)