Skip to content

Commit 0d8a3e1

Browse files
author
Jonathan Visser
committed
Use gpg keys for APT, optimize APT update, confirm NodeJS installation
1 parent 1c2a684 commit 0d8a3e1

File tree

1 file changed

+30
-34
lines changed

1 file changed

+30
-34
lines changed

ci/build/Dockerfile

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,33 @@ ARG PHP_VERSION
55

66
ENV DEBIAN_FRONTEND=noninteractive
77

8-
RUN apt-get update \
9-
&& apt-get install -y --no-install-recommends \
10-
git zip unzip wget \
11-
&& rm -rf /var/lib/apt/lists/*
8+
RUN apt-get update
9+
10+
RUN apt-get install -y --no-install-recommends \
11+
git zip unzip wget
1212

1313
# Add repositories
14-
RUN apt-get update \
15-
&& apt-get install -y --no-install-recommends \
16-
apt-transport-https \
17-
ca-certificates \
18-
curl \
19-
gnupg-agent \
20-
gnupg \
21-
software-properties-common \
22-
gettext-base \
23-
&& rm -rf /var/lib/apt/lists/* \
24-
&& curl -sSL http://debian.hypernode.com/repo.key | apt-key add - \
25-
&& echo "deb http://debian.hypernode.com bookworm main hypernode" | tee /etc/apt/sources.list.d/hypernode.list \
26-
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
27-
&& echo "deb http://deb.nodesource.com/node_${NODE_VERSION}.x bookworm main" | tee /etc/apt/sources.list.d/nodesource.list \
14+
RUN apt-get install -y --no-install-recommends \
15+
apt-transport-https \
16+
ca-certificates \
17+
curl \
18+
gnupg-agent \
19+
gnupg \
20+
software-properties-common \
21+
gettext-base
22+
23+
RUN apt-get clean \
24+
&& curl -fsSL http://debian.hypernode.com/repo.key | gpg --dearmor -o /usr/share/keyrings/hypernode.gpg \
25+
&& echo "deb [signed-by=/usr/share/keyrings/hypernode.gpg] http://debian.hypernode.com bookworm main hypernode" > /etc/apt/sources.list.d/hypernode.list \
2826
&& echo \
29-
"Package: * \
30-
Pin origin deb.nodesource.com \
31-
Pin-Priority: 1001" > /etc/apt/preferences.d/nodejs
27+
"Package: * \
28+
Pin origin debian.hypernode.com \
29+
Pin-Priority: 1000" > /etc/apt/preferences.d/hypernode
30+
31+
RUN curl -fsSL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash -
3232

3333
# Install dependencies
34-
RUN apt-get update && \
35-
apt-get install -y --no-install-recommends \
34+
RUN apt-get install -y --no-install-recommends \
3635
openssh-client \
3736
rsync \
3837
git \
@@ -52,8 +51,10 @@ RUN apt-get update && \
5251
nodejs \
5352
gnupg \
5453
zip \
55-
bc \
56-
&& apt install -y --no-install-recommends \
54+
bc
55+
56+
# Install PHP
57+
RUN apt-get install -y --no-install-recommends \
5758
php${PHP_VERSION} \
5859
php${PHP_VERSION}-amqp \
5960
php${PHP_VERSION}-bcmath \
@@ -78,15 +79,10 @@ RUN apt-get update && \
7879
php${PHP_VERSION}-soap \
7980
php${PHP_VERSION}-tidy \
8081
php${PHP_VERSION}-xml \
81-
php${PHP_VERSION}-zip \
82-
&& rm -rf /var/lib/apt/lists/*
83-
84-
# Only install npm if node version is less than 20, otherwise it's already installed
85-
RUN if [ "${NODE_VERSION}" -lt 20 ]; then \
86-
apt-get update \
87-
&& apt-get install -y --no-install-recommends npm \
88-
&& rm -rf /var/lib/apt/lists/*; \
89-
fi
82+
php${PHP_VERSION}-zip
83+
84+
# Confirm NodeJS & NPM are installed
85+
RUN node -v && npm -v
9086

9187
COPY ./.git /hypernode/.git
9288
COPY ./bin /hypernode/bin

0 commit comments

Comments
 (0)