mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
build(Docker): improve image size, by deleting node-compile-cache
This commit is contained in:
parent
907b8c503e
commit
70e227f4c3
12
Dockerfile
12
Dockerfile
@ -14,7 +14,9 @@ RUN npm ci && \
|
||||
mv dist/* \
|
||||
start-docker.sh \
|
||||
/usr/src/app/ && \
|
||||
rm -rf /usr/src/app/build
|
||||
rm -rf \
|
||||
/usr/src/app/build \
|
||||
/tmp/node-compile-cache
|
||||
|
||||
#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),
|
||||
@ -29,14 +31,16 @@ WORKDIR /usr/src/app
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
gosu && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
rm -rf /var/cache/apt/*
|
||||
rm -rf \
|
||||
/var/lib/apt/lists/* \
|
||||
/var/cache/apt/*
|
||||
|
||||
COPY --from=builder /usr/src/app ./
|
||||
|
||||
RUN sed -i "/electron/d" package.json && \
|
||||
npm ci --omit=dev && \
|
||||
npm cache clean --force
|
||||
npm cache clean --force && \
|
||||
rm -rf /tmp/node-compile-cache
|
||||
|
||||
# Configure container
|
||||
EXPOSE 8080
|
||||
|
@ -14,7 +14,9 @@ RUN npm ci && \
|
||||
mv dist/* \
|
||||
start-docker.sh \
|
||||
/usr/src/app/ && \
|
||||
rm -rf /usr/src/app/build
|
||||
rm -rf \
|
||||
/usr/src/app/build \
|
||||
/tmp/node-compile-cache
|
||||
|
||||
#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),
|
||||
@ -32,7 +34,8 @@ COPY --from=builder /usr/src/app ./
|
||||
|
||||
RUN sed -i "/electron/d" package.json && \
|
||||
npm ci --omit=dev && \
|
||||
npm cache clean --force
|
||||
npm cache clean --force && \
|
||||
rm -rf /tmp/node-compile-cache
|
||||
|
||||
# Add application user
|
||||
RUN adduser -s /bin/false node; exit 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user