From 9560366c114febbd769540a7bc10e4aca66b3d02 Mon Sep 17 00:00:00 2001 From: Yadd Date: Tue, 23 Jan 2024 10:22:12 +0400 Subject: [PATCH] Reduce docker image from 1.39 GB to 611 MB --- .../docker/tdrive-nextcloud-migration/Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tdrive/docker/tdrive-nextcloud-migration/Dockerfile b/tdrive/docker/tdrive-nextcloud-migration/Dockerfile index 351cf909b..9d79b001e 100644 --- a/tdrive/docker/tdrive-nextcloud-migration/Dockerfile +++ b/tdrive/docker/tdrive-nextcloud-migration/Dockerfile @@ -1,8 +1,8 @@ # Use an official Node.js runtime as the base image -FROM node:bullseye +FROM node:bullseye-slim AS updated RUN apt update && apt -y dist-upgrade -RUN apt install dirmngr +RUN apt install -y gnupg RUN echo "deb http://ppa.launchpad.net/nextcloud-devs/client/ubuntu zesty main" >> /etc/apt/sources.list.d/nextcloud-client.list RUN echo "deb-src http://ppa.launchpad.net/nextcloud-devs/client/ubuntu zesty main" >> /etc/apt/sources.list.d/nextcloud-client.list @@ -13,10 +13,12 @@ RUN apt update -y RUN apt install --assume-yes nextcloud-desktop-cmd -RUN apt install ldap-utils +RUN apt install -y ldap-utils RUN apt autoremove && apt clean && rm -rf /var/lib/apt/lists/* +FROM updated + # Set the working directory inside the container WORKDIR /usr/src/app @@ -32,4 +34,10 @@ RUN npm i && npm run build && npm cache clean --force && rm -rf node_modules RUN perl -i -ne 'print unless/prestart/' package.json # Run the Node.js application -CMD ["npm", "run", "start"] +#CMD ["npm", "run", "start"] + +FROM updated + +COPY --from=1 /usr/src/app/dist/* / + +CMD ["node","express_server.js"]