Skip to content

Commit 58d58ae

Browse files
committed
Adding Node 20 images + a "build" variant that contains build-essentials
1 parent fb4eb17 commit 58d58ae

20 files changed

+1891
-18
lines changed

.github/workflows/workflow.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,19 @@ jobs:
1818
- variant: '14-bullseye'
1919
- variant: '16-bullseye'
2020
- variant: '18-bullseye'
21+
- variant: '20-bullseye'
2122
- variant: '14-apache-bullseye'
2223
- variant: '16-apache-bullseye'
2324
- variant: '18-apache-bullseye'
25+
- variant: '20-apache-bullseye'
26+
- variant: '14-bullseye-build'
27+
- variant: '16-bullseye-build'
28+
- variant: '18-bullseye-build'
29+
- variant: '20-bullseye-build'
30+
- variant: '14-apache-bullseye-build'
31+
- variant: '16-apache-bullseye-build'
32+
- variant: '18-apache-bullseye-build'
33+
- variant: '20-apache-bullseye-build'
2434
runs-on: ubuntu-latest
2535
steps:
2636
- name: Set up QEMU

Dockerfile.14-apache-bullseye

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ COPY utils/apache2-foreground /usr/local/bin/
217217
CMD ["apache2-foreground"]
218218

219219

220+
221+
220222
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
221223

222224

Dockerfile.14-apache-bullseye-build

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
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+
curl -sL https://deb.nodesource.com/setup_14.x | bash - &&\
123+
apt-get update &&\
124+
apt-get install -y --no-install-recommends nodejs
125+
126+
# |--------------------------------------------------------------------------
127+
# | yarn
128+
# |--------------------------------------------------------------------------
129+
# |
130+
# | Installs yarn. It provides some nice improvements over npm.
131+
# |
132+
133+
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
134+
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
135+
apt-get update &&\
136+
apt-get install -y --no-install-recommends yarn
137+
138+
# |--------------------------------------------------------------------------
139+
# | PATH updating
140+
# |--------------------------------------------------------------------------
141+
# |
142+
# | Let's add ./node_modules/.bin to the PATH (utility function to use NPM bin easily)
143+
# |
144+
145+
ENV PATH="$PATH:./node_modules/.bin"
146+
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
147+
148+
USER docker
149+
# |--------------------------------------------------------------------------
150+
# | SSH client
151+
# |--------------------------------------------------------------------------
152+
# |
153+
# | Let's set-up the SSH client (for connections to private git repositories)
154+
# | We create an empty known_host file and we launch the ssh-agent
155+
# |
156+
157+
RUN mkdir ~/.ssh && touch ~/.ssh/known_hosts && chmod 644 ~/.ssh/known_hosts && eval $(ssh-agent -s)
158+
159+
# |--------------------------------------------------------------------------
160+
# | .bashrc updating
161+
# |--------------------------------------------------------------------------
162+
# |
163+
# | Let's update the .bashrc to add nice aliases
164+
# |
165+
RUN { \
166+
echo "alias ls='ls --color=auto'"; \
167+
echo "alias ll='ls --color=auto -alF'"; \
168+
echo "alias la='ls --color=auto -A'"; \
169+
echo "alias l='ls --color=auto -CF'"; \
170+
} >> ~/.bashrc
171+
172+
USER root
173+
174+
# |--------------------------------------------------------------------------
175+
# | Entrypoint
176+
# |--------------------------------------------------------------------------
177+
# |
178+
# | Defines the entrypoint.
179+
# |
180+
181+
ENV NODE_VERSION=14.x
182+
183+
184+
RUN mkdir -p /var/www/html && chown docker:docker /var/www/html
185+
WORKDIR /var/www/html
186+
187+
188+
COPY utils/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
189+
COPY utils/docker-entrypoint-as-root.sh /usr/local/bin/docker-entrypoint-as-root.sh
190+
COPY utils/startup_commands.js /usr/local/bin/startup_commands.js
191+
COPY utils/generate_cron.js /usr/local/bin/generate_cron.js
192+
193+
194+
195+
COPY utils/enable_apache_mods.js /usr/local/bin/enable_apache_mods.js
196+
COPY utils/apache-expose-envvars.sh /usr/local/bin/apache-expose-envvars.sh
197+
198+
# 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"
199+
RUN echo "ServerName localhost" > /etc/apache2/conf-available/servername.conf
200+
RUN a2enconf servername
201+
202+
EXPOSE 80
203+
204+
# |--------------------------------------------------------------------------
205+
# | Apache user
206+
# |--------------------------------------------------------------------------
207+
# |
208+
# | Defines Apache user. By default, we switch this to "docker" user.
209+
# | This way, no problem to write from Apache in the current working directory.
210+
# | Important! This should be changed back to www-data in production.
211+
# |
212+
213+
ENV APACHE_RUN_USER=docker \
214+
APACHE_RUN_GROUP=docker
215+
216+
COPY utils/apache2-foreground /usr/local/bin/
217+
CMD ["apache2-foreground"]
218+
219+
220+
221+
# Let's install the build tools (useful for node-gyp)
222+
RUN apt-get update &&\
223+
apt-get install -y --no-install-recommends build-essential
224+
225+
226+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
227+
228+
229+
USER docker

Dockerfile.14-bullseye

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ COPY utils/generate_cron.js /usr/local/bin/generate_cron.js
125125
CMD [ "node" ]
126126

127127

128+
129+
128130
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
129131

130132

0 commit comments

Comments
 (0)