Skip to content

Commit 5fc04e6

Browse files
committed
Adding support for Node 26
1 parent aec7036 commit 5fc04e6

8 files changed

Lines changed: 742 additions & 1 deletion

.github/workflows/workflow.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,25 @@ jobs:
2121
- variant: '20-bullseye'
2222
- variant: '22-bullseye'
2323
- variant: '24-bullseye'
24+
- variant: '26-bullseye'
2425
- variant: '16-apache-bullseye'
2526
- variant: '18-apache-bullseye'
2627
- variant: '20-apache-bullseye'
2728
- variant: '22-apache-bullseye'
2829
- variant: '24-apache-bullseye'
30+
- variant: '26-apache-bullseye'
2931
- variant: '16-bullseye-build'
3032
- variant: '18-bullseye-build'
3133
- variant: '20-bullseye-build'
3234
- variant: '22-bullseye-build'
3335
- variant: '24-bullseye-build'
36+
- variant: '26-bullseye-build'
3437
- variant: '16-apache-bullseye-build'
3538
- variant: '18-apache-bullseye-build'
3639
- variant: '20-apache-bullseye-build'
3740
- variant: '22-apache-bullseye-build'
3841
- variant: '24-apache-bullseye-build'
42+
- variant: '26-apache-bullseye-build'
3943
runs-on: ubuntu-latest
4044
steps:
4145
- name: Set up QEMU

Dockerfile.26-apache-bullseye

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

0 commit comments

Comments
 (0)