Reduce docker image from 1.39 GB to 611 MB (#341)

* Reduce docker image from 1.39 GB to 611 MB
* Declare environment variables
This commit is contained in:
Yadd
2024-01-30 15:28:36 +04:00
committed by GitHub
parent 49ac30136b
commit 1ade3de40d
@@ -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"]