Skip to content

Commit 8cd4125

Browse files
committed
Adding support for Node 22
1 parent 4535ccd commit 8cd4125

23 files changed

+745
-17
lines changed

.github/workflows/workflow.yml

+4
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ jobs:
1919
- variant: '16-bullseye'
2020
- variant: '18-bullseye'
2121
- variant: '20-bullseye'
22+
- variant: '22-bullseye'
2223
- variant: '14-apache-bullseye'
2324
- variant: '16-apache-bullseye'
2425
- variant: '18-apache-bullseye'
2526
- variant: '20-apache-bullseye'
27+
- variant: '22-apache-bullseye'
2628
- variant: '14-bullseye-build'
2729
- variant: '16-bullseye-build'
2830
- variant: '18-bullseye-build'
2931
- variant: '20-bullseye-build'
32+
- variant: '22-bullseye-build'
3033
- variant: '14-apache-bullseye-build'
3134
- variant: '16-apache-bullseye-build'
3235
- variant: '18-apache-bullseye-build'
3336
- variant: '20-apache-bullseye-build'
37+
- variant: '22-apache-bullseye-build'
3438
runs-on: ubuntu-latest
3539
steps:
3640
- name: Set up QEMU

Dockerfile.14-apache-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.14-apache-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.14-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.14-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.16-apache-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.16-apache-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.16-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.16-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.18-apache-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.18-apache-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.18-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.18-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.20-apache-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.20-apache-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.20-bullseye

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.20-bullseye-build

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# DO NOT EDIT THIS FILE : Make yours changes in /utils/Dockerfile.blueprint)
21
FROM debian:bullseye-slim
32

43
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"

Dockerfile.22-apache-bullseye

+227
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
FROM debian:bullseye-slim
2+
3+
LABEL authors="Julien Neuhart <[email protected]>, David Négrier <[email protected]>"
4+
5+
# |--------------------------------------------------------------------------
6+
# | Required libraries
7+
# |--------------------------------------------------------------------------
8+
# |
9+
# | Installs required libraries.
10+
# |
11+
12+
RUN apt-get update &&\
13+
apt-get install -y --no-install-recommends curl git nano sudo ca-certificates procps libfontconfig tini --no-install-recommends
14+
15+
# |--------------------------------------------------------------------------
16+
# | Supercronic
17+
# |--------------------------------------------------------------------------
18+
# |
19+
# | Supercronic is a drop-in replacement for cron (for containers).
20+
# |
21+
22+
RUN SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.12/supercronic-linux-$( dpkg --print-architecture ) \
23+
&& SUPERCRONIC=supercronic-linux-$( dpkg --print-architecture ) \
24+
&& curl -fsSLO "$SUPERCRONIC_URL" \
25+
&& chmod +x "$SUPERCRONIC" \
26+
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
27+
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
28+
29+
# |--------------------------------------------------------------------------
30+
# | User
31+
# |--------------------------------------------------------------------------
32+
# |
33+
# | Define a default user with sudo rights.
34+
# |
35+
36+
RUN useradd -ms /bin/bash docker && adduser docker sudo
37+
# Users in the sudoers group can sudo as root without password.
38+
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
39+
40+
41+
42+
# |--------------------------------------------------------------------------
43+
# | Apache
44+
# |--------------------------------------------------------------------------
45+
# |
46+
# | Installs Apache.
47+
# |
48+
49+
RUN apt-get update \
50+
&& apt-get install -y --no-install-recommends \
51+
apache2 \
52+
&& rm -rf /var/lib/apt/lists/*
53+
54+
ENV APACHE_CONFDIR /etc/apache2
55+
ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars
56+
57+
RUN set -ex \
58+
\
59+
# generically convert lines like
60+
# export APACHE_RUN_USER=www-data
61+
# into
62+
# : ${APACHE_RUN_USER:=www-data}
63+
# export APACHE_RUN_USER
64+
# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...")
65+
&& sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \
66+
\
67+
# setup directories and permissions
68+
&& . "$APACHE_ENVVARS" \
69+
&& for dir in \
70+
"$APACHE_LOCK_DIR" \
71+
"$APACHE_RUN_DIR" \
72+
"$APACHE_LOG_DIR" \
73+
/var/www/html \
74+
; do \
75+
rm -rvf "$dir" \
76+
&& mkdir -p "$dir" \
77+
&& chown -R "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \
78+
done
79+
80+
# logs should go to stdout / stderr
81+
RUN set -ex \
82+
&& . "$APACHE_ENVVARS" \
83+
&& ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \
84+
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \
85+
&& ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"
86+
87+
ENV APACHE_DOCUMENT_ROOT /
88+
89+
RUN { \
90+
echo 'DirectoryIndex disabled'; \
91+
echo 'DirectoryIndex index.html'; \
92+
echo; \
93+
echo '<Directory /var/www/>'; \
94+
echo '\tOptions -Indexes'; \
95+
echo '\tAllowOverride All'; \
96+
echo '</Directory>'; \
97+
} | tee "$APACHE_CONFDIR/conf-available/nodejs.conf" \
98+
&& a2enconf nodejs
99+
100+
RUN sed -ri -e 's!/var/www/html!/var/www/html/${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
101+
RUN sed -ri -e 's!/var/www/!/var/www/html/${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
102+
103+
# |--------------------------------------------------------------------------
104+
# | Apache mod_rewrite
105+
# |--------------------------------------------------------------------------
106+
# |
107+
# | Enables Apache mod_rewrite.
108+
# |
109+
110+
RUN a2enmod rewrite
111+
112+
113+
# |--------------------------------------------------------------------------
114+
# | NodeJS
115+
# |--------------------------------------------------------------------------
116+
# |
117+
# | Installs NodeJS and npm.
118+
# |
119+
120+
RUN apt-get update &&\
121+
apt-get install -y --no-install-recommends gnupg &&\
122+
mkdir -p /etc/apt/keyrings && \
123+
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
124+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list &&\
125+
apt-get update &&\
126+
apt-get install -y --no-install-recommends nodejs
127+
128+
# |--------------------------------------------------------------------------
129+
# | yarn
130+
# |--------------------------------------------------------------------------
131+
# |
132+
# | Installs yarn. It provides some nice improvements over npm.
133+
# |
134+
135+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
136+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
137+
apt-get update &&\
138+
apt-get install -y --no-install-recommends yarn
139+
140+
# |--------------------------------------------------------------------------
141+
# | PATH updating
142+
# |--------------------------------------------------------------------------
143+
# |
144+
# | Let's add ./node_modules/.bin to the PATH (utility function to use NPM bin easily)
145+
# |
146+
147+
ENV PATH="$PATH:./node_modules/.bin"
148+
RUN sed -i 's#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin#/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:./node_modules/.bin#g' /etc/sudoers
149+
150+
USER docker
151+
# |--------------------------------------------------------------------------
152+
# | SSH client
153+
# |--------------------------------------------------------------------------
154+
# |
155+
# | Let's set-up the SSH client (for connections to private git repositories)
156+
# | We create an empty known_host file and we launch the ssh-agent
157+
# |
158+
159+
RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval $(ssh-agent -s)
160+
161+
# |--------------------------------------------------------------------------
162+
# | .bashrc updating
163+
# |--------------------------------------------------------------------------
164+
# |
165+
# | Let's update the .bashrc to add nice aliases
166+
# |
167+
RUN { \
168+
echo "alias ls='ls --color=auto'"; \
169+
echo "alias ll='ls --color=auto -alF'"; \
170+
echo "alias la='ls --color=auto -A'"; \
171+
echo "alias l='ls --color=auto -CF'"; \
172+
} >> ~/.bashrc
173+
174+
USER root
175+
176+
# |--------------------------------------------------------------------------
177+
# | Entrypoint
178+
# |--------------------------------------------------------------------------
179+
# |
180+
# | Defines the entrypoint.
181+
# |
182+
183+
ENV NODE_VERSION=22.x
184+
185+
186+
RUN mkdir -p /var/www/html && chown docker:docker /var/www/html
187+
WORKDIR /var/www/html
188+
189+
190+
COPY utils/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
191+
COPY utils/docker-entrypoint-as-root.sh /usr/local/bin/docker-entrypoint-as-root.sh
192+
COPY utils/startup_commands.js /usr/local/bin/startup_commands.js
193+
COPY utils/generate_cron.js /usr/local/bin/generate_cron.js
194+
195+
196+
197+
COPY utils/enable_apache_mods.js /usr/local/bin/enable_apache_mods.js
198+
COPY utils/apache-expose-envvars.sh /usr/local/bin/apache-expose-envvars.sh
199+
200+
# Let's register a servername to remove the message "apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message"
201+
RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf
202+
RUN a2enconf servername
203+
204+
EXPOSE 80
205+
206+
# |--------------------------------------------------------------------------
207+
# | Apache user
208+
# |--------------------------------------------------------------------------
209+
# |
210+
# | Defines Apache user. By default, we switch this to "docker" user.
211+
# | This way, no problem to write from Apache in the current working directory.
212+
# | Important! This should be changed back to www-data in production.
213+
# |
214+
215+
ENV APACHE_RUN_USER=docker \
216+
APACHE_RUN_GROUP=docker
217+
218+
COPY utils/apache2-foreground /usr/local/bin/
219+
CMD ["apache2-foreground"]
220+
221+
222+
223+
224+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
225+
226+
227+
USER docker

0 commit comments

Comments
 (0)