Skip to content

Commit 90936ac

Browse files
authored
Merge pull request #197 from laminas/qa/migrate-nodejs-installation
Migrate nodejs installation to recommended by nodesource
2 parents d041993 + 9e015a0 commit 90936ac

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

Dockerfile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1+
ARG NODE_MAJOR=20
2+
13
# Aliasing base images, so we can change just this, when needing to upgrade or pull base layers
24
FROM ubuntu:22.04 AS base-distro
35
FROM composer:2.6.6 AS composer
46

5-
67
FROM base-distro AS install-markdownlint
8+
ARG NODE_MAJOR
9+
ENV NODE_MAJOR=$NODE_MAJOR
710

811
# Install system dependencies first - these don't change much
9-
RUN export DEBIAN_FRONTEND=noninteractive \
10-
&& (curl -ssL https://deb.nodesource.com/setup_20.x | bash -) \
12+
RUN set -eux; \
13+
export DEBIAN_FRONTEND=noninteractive \
14+
&& apt update \
15+
&& apt install -y --no-install-recommends \
16+
ca-certificates \
17+
curl \
18+
gnupg \
19+
&& mkdir -p /etc/apt/keyrings \
20+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
21+
&& 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 \
1122
&& apt update \
1223
&& apt install -y --no-install-recommends \
13-
npm \
24+
nodejs \
1425
&& apt clean
1526

1627
COPY setup/markdownlint/package.json \
@@ -30,32 +41,39 @@ RUN cd /markdownlint \
3041

3142

3243
FROM base-distro
33-
44+
ARG NODE_MAJOR
3445
LABEL "repository"="http://github.com/laminas/laminas-continuous-integration-action"
3546
LABEL "homepage"="http://github.com/laminas/laminas-continuous-integration-action"
3647
LABEL "maintainer"="https://github.com/laminas/technical-steering-committee/"
3748

3849
ENV COMPOSER_HOME=/usr/local/share/composer \
3950
DEBIAN_FRONTEND=noninteractive \
40-
ACCEPT_EULA=Y
51+
ACCEPT_EULA=Y \
52+
NODE_MAJOR=$NODE_MAJOR
4153

4254
# This may look a bit long, but it's just a big `apt install` section, followed by a cleanup,
4355
# so that we get a single compact layer, with not too many layer overwrites.
44-
RUN export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \
56+
RUN set -eux; \
57+
export OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | cut -d '"' -f2) \
4558
&& apt update \
4659
&& apt upgrade -y \
4760
&& apt install -y --no-install-recommends \
4861
curl \
4962
gpg-agent \
5063
software-properties-common \
64+
ca-certificates \
65+
gnupg \
5166
&& (curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | tee /etc/apt/trusted.gpg.d/microsoft.gpg) \
5267
&& add-apt-repository -y ppa:ondrej/php \
5368
&& curl -sSL https://packages.microsoft.com/config/ubuntu/$OS_VERSION/prod.list | tee /etc/apt/sources.list.d/microsoft.list \
54-
&& (curl -ssL https://deb.nodesource.com/setup_20.x | bash -) \
69+
&& mkdir -p /etc/apt/keyrings \
70+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
71+
&& 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 \
5572
&& apt update \
5673
&& apt install -y --no-install-recommends \
5774
# Base dependencies
5875
git \
76+
nodejs \
5977
jq \
6078
libxml2-utils \
6179
libzip-dev \
@@ -274,7 +292,8 @@ COPY composer.json \
274292
/tools/
275293

276294
# Set default PHP version based on the `composer.json` `config.platform.php` setting
277-
RUN export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?<minor>[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \
295+
RUN set -eux; \
296+
export DEFAULT_PHP_VERSION=$(jq -r '.config.platform.php | sub("(?<minor>[0-9.]).99$"; "\(.minor)")' /tools/composer.json) \
278297
&& update-alternatives --set php /usr/bin/php$DEFAULT_PHP_VERSION \
279298
&& update-alternatives --set phpize /usr/bin/phpize$DEFAULT_PHP_VERSION \
280299
&& update-alternatives --set php-config /usr/bin/php-config$DEFAULT_PHP_VERSION \

0 commit comments

Comments
 (0)