mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-10-23 06:12:23 +00:00
fix: Remove 60 MB (28%) of dev dependencies from Docker image (#28160)
This commit is contained in:
1 file changed
+4
-1
+4
-1
@@ -13,11 +13,14 @@ COPY package.json pnpm-lock.yaml ./
|
||||
|
||||
# Make and such are needed to compile serialport for riscv64
|
||||
# Install pnpm, configure a tmp-based store, then use it under a cache mount so each arch gets its own store
|
||||
# NOTE: We do not install devDependencies here (the --prod argument in pnpm install) as we use an already
|
||||
# built artifact (./dist directory) from previous GitHub runner stages. Omitting devDependencies here
|
||||
# saves storage as this node_modules/ is being copied straight to the release stage later.
|
||||
RUN --mount=type=cache,id=pnpm-store,target=/tmp/pnpm-store \
|
||||
apk add --no-cache make gcc g++ python3 linux-headers npm && \
|
||||
npm install -g pnpm@$(sed -n 's/.*"packageManager": "pnpm@\([0-9.]*\)".*/\1/p' package.json) && \
|
||||
pnpm config set store-dir /tmp/pnpm-store && \
|
||||
pnpm install --frozen-lockfile --no-optional && \
|
||||
pnpm install --frozen-lockfile --prod --no-optional && \
|
||||
# serialport has outdated prebuilds that appear to fail on some archs, force build on target platform
|
||||
rm -rf $(find ./node_modules/.pnpm/ -wholename "*/@serialport/bindings-cpp/prebuilds" -type d) && \
|
||||
pnpm rebuild @serialport/bindings-cpp
|
||||
|
||||
Reference in new issue
Block a user