Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
build(Docker): improve image size, by deleting unnecessary node_modules fodler from dist folder
Panagiotis Papadopoulos38690053a8cb
diff --git a/Dockerfile b/Dockerfileindex 54db47144b..52a0872027 100644--- a/Dockerfile+++ b/Dockerfile@@ -10,6 +10,7 @@ COPY . .RUN npm ci && \npm run build:prepare-dist && \npm cache clean --force && \+ rm -rf dist/node_modules && \mv dist/* \start-docker.sh \package-lock.json \@@ -17,6 +18,9 @@ RUN npm ci && \rm -rf /usr/src/app/build#TODO: move package-lock copying into copy-dist+#TODO: improve node_modules handling in copy-dist/Dockerfile -> remove duplicated work+# currently copy-dist will copy certain node_module folders, but in the Dockerfile we delete them again (to keep image size down),+# as we install necessary dependencies in runtime buildstage anyways# Runtime stageFROM node:22.14.0-bullseye-slimdiff --git a/Dockerfile.alpine b/Dockerfile.alpineindex 43eac8ca70..3d2198bf08 100644--- a/Dockerfile.alpine+++ b/Dockerfile.alpine@@ -10,6 +10,7 @@ COPY . .RUN npm ci && \npm run build:prepare-dist && \npm cache clean --force && \+ rm -rf dist/node_modules && \mv dist/* \start-docker.sh \package-lock.json \@@ -17,6 +18,9 @@ RUN npm ci && \rm -rf /usr/src/app/build#TODO: move package-lock copying into copy-dist+#TODO: improve node_modules handling in copy-dist/Dockerfile -> remove duplicated work+# currently copy-dist will copy certain node_module folders, but in the Dockerfile we delete them again (to keep image size down),+# as we install necessary dependencies in runtime buildstage anyways# Runtime stageFROM node:22.14.0-alpine