From addc5e5174bf94c5f62a16aef0bfbf589eb6cb43 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Kandula Date: Wed, 11 Oct 2023 15:12:32 +0530 Subject: [PATCH] chore: Install NodeJS manually instead of with the deprecated script (#27929) Fixes #26891. --- Dockerfile | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index cf0f664378..9b4a29f641 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,17 +23,14 @@ RUN apt-get update \ && apt-get remove --yes git python3-pip python3-venv \ && apt-get autoremove --yes -# Install MongoDB v5.0.14, Redis, NodeJS - Service Layer, PostgreSQL v13 +# Install MongoDB v5.0.14, Redis, PostgreSQL v13 RUN curl --silent --show-error --location https://www.mongodb.org/static/pgp/server-5.0.asc | apt-key add - \ && echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-5.0.list \ - && curl --silent --show-error --location https://deb.nodesource.com/setup_18.x | bash - \ - && echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \ + && echo "deb http://apt.postgresql.org/pub/repos/apt $(grep CODENAME /etc/lsb-release | cut -d= -f2)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \ && curl --silent --show-error --location https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \ && apt update \ - && apt-get install --no-install-recommends --yes mongodb-org nodejs redis postgresql-13 \ - && apt-get clean \ - # This is to get semver 7.5.2, for a CVE fix, might be able to remove it with later versions on NodeJS. - && npm install -g npm@9.7.2 + && apt-get install --no-install-recommends --yes mongodb-org redis postgresql-13 \ + && apt-get clean # Install Java RUN set -o xtrace \ @@ -43,6 +40,12 @@ RUN set -o xtrace \ && curl --location --output /tmp/java.tar.gz "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-$version/OpenJDK17U-jdk_$(uname -m | sed s/x86_64/x64/)_linux_hotspot_$(echo $version | tr + _).tar.gz" \ && tar -xzf /tmp/java.tar.gz -C /opt/java --strip-components 1 +# Install NodeJS +RUN set -o xtrace \ + && mkdir -p /opt/node \ + && file="$(curl -sS 'https://nodejs.org/dist/latest-v18.x/' | awk -F\" '$2 ~ /linux-'"$(uname -m | sed 's/x86_64/x64/; s/aarch64/arm64/')"'.tar.gz/ {print $2}')" \ + && curl "https://nodejs.org/dist/latest-v18.x/$file" | tar -xz -C /opt/node --strip-components 1 + # Clean up cache file - Service layer RUN rm -rf \ /root/.cache \ @@ -85,6 +88,8 @@ COPY ./app/client/build editor/ # Add RTS - Application Layer COPY ./app/client/packages/rts/dist rts/ +ENV PATH /opt/appsmith/utils/node_modules/.bin:/opt/java/bin:/opt/node/bin:$PATH + RUN cd ./utils && npm install --only=prod && npm install --only=prod -g . && cd - \ && chmod 0644 /etc/cron.d/* \ && chmod +x entrypoint.sh renew-certificate.sh healthcheck.sh templates/nginx-app.conf.sh /watchtower-hooks/*.sh \ @@ -92,8 +97,6 @@ RUN cd ./utils && npm install --only=prod && npm install --only=prod -g . && cd && find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -print -exec chmod -s '{}' + \) || true \ && node prepare-image.mjs -ENV PATH /opt/appsmith/utils/node_modules/.bin:/opt/java/bin:$PATH - LABEL com.centurylinklabs.watchtower.lifecycle.pre-check=/watchtower-hooks/pre-check.sh LABEL com.centurylinklabs.watchtower.lifecycle.pre-update=/watchtower-hooks/pre-update.sh