From 1ade3de40d7c1836a6ac2d732985f7b92d417cec Mon Sep 17 00:00:00 2001 From: Yadd Date: Tue, 30 Jan 2024 15:28:36 +0400 Subject: [PATCH] Reduce docker image from 1.39 GB to 611 MB (#341) * Reduce docker image from 1.39 GB to 611 MB * Declare environment variables --- .../tdrive-nextcloud-migration/Dockerfile | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/tdrive/docker/tdrive-nextcloud-migration/Dockerfile b/tdrive/docker/tdrive-nextcloud-migration/Dockerfile index 351cf909..ee980426 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,23 @@ 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 + +ENV SERVER_PORT=3000 \ + LDAP_BASE= \ + LDAP_URL= \ + LEMON_USERS_URL= \ + LEMON_USERS_AUTH= \ + TMP_DIR=/tmp \ + NEXTCLOUD_URL= \ + TWAKE_DRIVE_URL= \ + TWAKE_DRIVE_APP_ID= \ + TWAKE_DRIVE_SECRET= \ + USER_PROVIDER= + +COPY --from=1 /usr/src/app/dist/* / +RUN mv express_server.js express_server.mjs + +CMD ["node","express_server.mjs"]