From a49fbf37d9b3910850c8f3e17730c3214ad92b46 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Thu, 28 Sep 2023 06:19:39 -0600 Subject: [PATCH] Use modern node.js install scheme --- gitea/Dockerfile.task-executor | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/gitea/Dockerfile.task-executor b/gitea/Dockerfile.task-executor index 63e7394..ad5cc64 100644 --- a/gitea/Dockerfile.task-executor +++ b/gitea/Dockerfile.task-executor @@ -7,8 +7,20 @@ RUN apt update && apt install -y gpg curl apt-transport-https ca-certificates ls RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null -# Add NodeJS repo -RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - +ARG NODE_MAJOR=18 -# Install Docker and NodeJS packages. -RUN apt update && apt install -y docker-ce nodejs && rm -rf /var/lib/apt/lists/* +# Add NodeJS repo +# See: https://stackoverflow.com/a/77021599/1701505 +RUN set -uex; \ + apt-get update; \ + apt-get install -y ca-certificates curl gnupg; \ + mkdir -p /etc/apt/keyrings; \ + curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key \ + | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \ + echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" \ + > /etc/apt/sources.list.d/nodesource.list; \ + apt-get update; \ + apt-get install nodejs -y; + +# Install Docker +RUN apt update && apt install -y docker-ce && rm -rf /var/lib/apt/lists/*