From 167289b01704f2ec83c80d2b61ecd7424f6cbb6c Mon Sep 17 00:00:00 2001 From: bob10042 Date: Fri, 30 Jan 2026 14:44:05 +0000 Subject: [PATCH] fix: Docker build fails with 'Unable to locate package nodejs' The NodeSource setup script adds the repository but doesn't refresh the apt cache, causing 'apt-get install nodejs' to fail with 'Unable to locate package'. Changes: - Add apt-get update after NodeSource setup script to refresh package lists - Combine NodeSource setup and nodejs install into single RUN for efficiency - Add apt-get clean and remove apt lists to reduce image size Fixes #333 --- Dockerfile | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ddc612660..8d8c06c98 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,20 @@ FROM nginx:1.23.0 +# Update apt and install required packages RUN apt-get update && apt-get upgrade -y -RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - -RUN apt-get install -y nodejs +# Install Node.js using NodeSource - run apt-get update after setup script +# The setup script adds the NodeSource repository but apt cache may be stale +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \ + && apt-get update \ + && apt-get install -y nodejs -RUN \ - apt-get install -y \ - libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 \ - libxss1 libasound2 libxtst6 xauth xvfb g++ make +# Install dependencies for Cypress and build tools +RUN apt-get install -y \ + libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 \ + libxss1 libasound2 libxtst6 xauth xvfb g++ make \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* WORKDIR /src/build-your-own-radar COPY package.json ./ @@ -17,7 +23,7 @@ RUN npm ci COPY . ./ -# Override parent node image's entrypoint script (/usr/local/bin/docker-entrypoint.sh), +# Override parent node image entrypoint script (/usr/local/bin/docker-entrypoint.sh), # which tries to run CMD as a node command ENTRYPOINT [] CMD ["./build_and_start_nginx.sh"]