Nextcloud migration:: add security tips + reduce size (#307)

* Add security tips
* Don't rebuild on start
* Build a full bundle with rollup, then minimize image size
This commit is contained in:
Yadd
2024-01-05 15:35:13 +04:00
committed by GitHub
parent 927d5a62bb
commit eae85905a0
4 changed files with 50 additions and 12 deletions
@@ -1,10 +1,12 @@
# Use an official Node.js runtime as the base image
FROM node:bullseye
run apt update && apt -y dist-upgrade
RUN apt install dirmngr
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
RUN apt install dirmngr
RUN apt-key adv --recv-key --keyserver keyserver.ubuntu.com AD3DD469
RUN apt update
@@ -13,6 +15,8 @@ RUN apt install --assume-yes nextcloud-desktop-cmd
RUN apt install ldap-utils
RUN apt autoremove && apt clean && rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /usr/src/app
@@ -20,8 +24,12 @@ WORKDIR /usr/src/app
COPY backend/utils/nextcloud-migration/src/** ./src/
COPY backend/utils/nextcloud-migration/.nvmrc ./
COPY backend/utils/nextcloud-migration/*.json ./
COPY backend/utils/nextcloud-migration/rollup.config.js ./
RUN npm i && npm run build
RUN npm i && npm run build && npm cache clean --force && rm -rf node_modules
# Don't rebuild on start
RUN perl -i -ne 'print unless/prestart/' package.json
# Run the Node.js application
CMD ["npm", "run", "start"]