From 47605d2243a4e7abc37b3bb7cc4ba5a5c5607542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6sing?= <2189546+boesing@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:47:31 +0200 Subject: [PATCH 1/2] qa: migrate nodejs installation to recommended by nodesource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See also https://github.com/nodesource/distributions#installation-instructions Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com> --- Dockerfile | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 261f6b3..6ed041f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,26 @@ +ARG NODE_MAJOR=20 + # Aliasing base images, so we can change just this, when needing to upgrade or pull base layers FROM ubuntu:22.04 AS base-distro FROM composer:2.4.4 AS composer - FROM base-distro AS install-markdownlint +ARG NODE_MAJOR +ENV NODE_MAJOR=$NODE_MAJOR # Install system dependencies first - these don't change much RUN export DEBIAN_FRONTEND=noninteractive \ - && (curl -ssL https://deb.nodesource.com/setup_20.x | bash -) \ && apt update \ && apt install -y --no-install-recommends \ - npm \ + 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" | tee /etc/apt/sources.list.d/nodesource.list \ + && apt update \ + && apt install -y --no-install-recommends \ + nodejs \ && apt clean COPY setup/markdownlint/package.json \ @@ -30,14 +40,15 @@ RUN cd /markdownlint \ FROM base-distro - +ARG NODE_MAJOR LABEL "repository"="http://github.com/laminas/laminas-continuous-integration-action" LABEL "homepage"="http://github.com/laminas/laminas-continuous-integration-action" LABEL "maintainer"="https://github.com/laminas/technical-steering-committee/" ENV COMPOSER_HOME=/usr/local/share/composer \ DEBIAN_FRONTEND=noninteractive \ - ACCEPT_EULA=Y + ACCEPT_EULA=Y \ + NODE_MAJOR=$NODE_MAJOR # This may look a bit long, but it's just a big `apt install` section, followed by a cleanup, # so that we get a single compact layer, with not too many layer overwrites. @@ -48,14 +59,19 @@ RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) curl \ gpg-agent \ software-properties-common \ + ca-certificates \ + gnupg \ && (curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg) \ && add-apt-repository -y ppa:ondrej/php \ && curl -sSL https://packages.microsoft.com/config/ubuntu/$OS_VERSION/prod.list | tee /etc/apt/sources.list.d/microsoft.list \ - && (curl -ssL https://deb.nodesource.com/setup_20.x | bash -) \ + && 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" | tee /etc/apt/sources.list.d/nodesource.list \ && apt update \ && apt install -y --no-install-recommends \ # Base dependencies git \ + nodejs \ jq \ libxml2-utils \ libzip-dev \ From 9e015a0ce13e369285eddd215dffdcf6789fa9a9 Mon Sep 17 00:00:00 2001 From: Aleksei Khudiakov Date: Wed, 31 Jan 2024 23:42:44 +1000 Subject: [PATCH 2/2] Add pipefail to dockerfile instructions Signed-off-by: Aleksei Khudiakov --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ed041f..a4a0ad0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,8 @@ ARG NODE_MAJOR ENV NODE_MAJOR=$NODE_MAJOR # Install system dependencies first - these don't change much -RUN export DEBIAN_FRONTEND=noninteractive \ +RUN set -eux; \ + export DEBIAN_FRONTEND=noninteractive \ && apt update \ && apt install -y --no-install-recommends \ ca-certificates \ @@ -52,7 +53,8 @@ ENV COMPOSER_HOME=/usr/local/share/composer \ # This may look a bit long, but it's just a big `apt install` section, followed by a cleanup, # so that we get a single compact layer, with not too many layer overwrites. -RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \ +RUN set -eux; \ + export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \ && apt update \ && apt upgrade -y \ && apt install -y --no-install-recommends \ @@ -290,7 +292,8 @@ COPY composer.json \ /tools/ # Set default PHP version based on the `composer.json` `config.platform.php` setting -RUN export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \ +RUN set -eux; \ + export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \ && update-alternatives --set php /usr/bin/php$DEFAULT_PHP_VERSION \ && update-alternatives --set phpize /usr/bin/phpize$DEFAULT_PHP_VERSION \ && update-alternatives --set php-config /usr/bin/php-config$DEFAULT_PHP_VERSION \