mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-20 18:41:35 +00:00
Reduce Docker image size again.
This commit is contained in:
+15
-5
@@ -3,15 +3,25 @@ FROM node:16-alpine3.15 as base
|
||||
WORKDIR /app
|
||||
RUN apk add --no-cache tzdata eudev tini
|
||||
|
||||
COPY package.json package-lock.json tsconfig.json index.js LICENSE index.js data/configuration.yaml ./
|
||||
COPY lib ./lib
|
||||
COPY dist ./dist
|
||||
COPY package.json ./
|
||||
|
||||
# Dependencies and build
|
||||
FROM base as dependencies_and_build
|
||||
|
||||
COPY package-lock.json tsconfig.json index.js ./
|
||||
COPY lib ./lib
|
||||
|
||||
# Install dependencies
|
||||
RUN apk add --no-cache --virtual .buildtools make gcc g++ python3 linux-headers git && \
|
||||
npm ci --production --no-audit --no-optional --no-update-notifier && \
|
||||
apk del .buildtools
|
||||
|
||||
# Release
|
||||
FROM base as release
|
||||
|
||||
COPY --from=dependencies_and_build /app/node_modules ./node_modules
|
||||
COPY dist ./dist
|
||||
COPY LICENSE index.js data/configuration.yaml ./
|
||||
|
||||
COPY docker/docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
@@ -21,4 +31,4 @@ ARG COMMIT
|
||||
RUN echo "$COMMIT" > dist/.hash
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD [ "/sbin/tini", "--", "node", "index.js"]
|
||||
CMD [ "/sbin/tini", "--", "node", "index.js"]
|
||||
Reference in New Issue
Block a user