mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
build(Docker): improve image size, by deleting unnecessary node_modules fodler from dist folder
added a TODO as well, to get rid of this strange step here at some point
This commit is contained in:
parent
3553d64060
commit
38690053a8
@ -10,6 +10,7 @@ COPY . .
|
|||||||
RUN npm ci && \
|
RUN npm ci && \
|
||||||
npm run build:prepare-dist && \
|
npm run build:prepare-dist && \
|
||||||
npm cache clean --force && \
|
npm cache clean --force && \
|
||||||
|
rm -rf dist/node_modules && \
|
||||||
mv dist/* \
|
mv dist/* \
|
||||||
start-docker.sh \
|
start-docker.sh \
|
||||||
package-lock.json \
|
package-lock.json \
|
||||||
@ -17,6 +18,9 @@ RUN npm ci && \
|
|||||||
rm -rf /usr/src/app/build
|
rm -rf /usr/src/app/build
|
||||||
|
|
||||||
#TODO: move package-lock copying into copy-dist
|
#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 stage
|
# Runtime stage
|
||||||
FROM node:22.14.0-bullseye-slim
|
FROM node:22.14.0-bullseye-slim
|
||||||
|
@ -10,6 +10,7 @@ COPY . .
|
|||||||
RUN npm ci && \
|
RUN npm ci && \
|
||||||
npm run build:prepare-dist && \
|
npm run build:prepare-dist && \
|
||||||
npm cache clean --force && \
|
npm cache clean --force && \
|
||||||
|
rm -rf dist/node_modules && \
|
||||||
mv dist/* \
|
mv dist/* \
|
||||||
start-docker.sh \
|
start-docker.sh \
|
||||||
package-lock.json \
|
package-lock.json \
|
||||||
@ -17,6 +18,9 @@ RUN npm ci && \
|
|||||||
rm -rf /usr/src/app/build
|
rm -rf /usr/src/app/build
|
||||||
|
|
||||||
#TODO: move package-lock copying into copy-dist
|
#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 stage
|
# Runtime stage
|
||||||
FROM node:22.14.0-alpine
|
FROM node:22.14.0-alpine
|
||||||
|
Loading…
x
Reference in New Issue
Block a user