Skip to content

Commit 1778407

Browse files
pdabelf5Rahul Somasundaram
authored andcommitted
update debian nap waf/dos image to debian:12 (nginx#5780)
* update debian nap waf/dos image to debian:12
1 parent 357e352 commit 1778407

File tree

1 file changed

+13
-34
lines changed

1 file changed

+13
-34
lines changed

build/Dockerfile

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,11 @@ ADD --link --chown=101:0 https://cs.nginx.com/static/files/app-protect-9.repo ap
7575
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-waf-v5-ubi-8.repo app-protect-v5-8.repo
7676
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-waf-v5-ubi-9.repo app-protect-v5-9.repo
7777
ADD --link --chown=101:0 https://cs.nginx.com/static/files/app-protect-dos-8.repo app-protect-dos-8.repo
78-
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/plus-debian-11.repo debian-plus-11.sources
7978
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/plus-debian-12.repo debian-plus-12.sources
80-
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-waf-debian-11.repo nap-waf-11.sources
81-
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-dos-debian-11.repo nap-dos-11.sources
79+
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-waf-debian-12.repo nap-waf-12.sources
80+
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-dos-debian-12.repo nap-dos-12.sources
8281
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/nap-waf-v5-debian-12.repo nap-waf-v5-12.sources
83-
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/agent-debian-11.repo debian-agent-11.sources
82+
ADD --link --chown=101:0 https://raw.githubusercontent.com/nginxinc/k8s-common/main/files/agent-debian-12.repo debian-agent-12.sources
8483

8584
RUN --mount=from=busybox:musl,src=/bin/,dst=/bin/ printf "%s\n" "Acquire::https::pkgs.nginx.com::User-Agent k8s-ic-$IC_VERSION${BUILD_OS##debian-plus}-apt;" >> 90pkgs-nginx \
8685
&& printf "%s\n" "user_agent=k8s-ic-$IC_VERSION${BUILD_OS##ubi*plus}-dnf" | tee -a nginx-plus-*.repo \
@@ -225,13 +224,15 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
225224
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
226225
--mount=type=bind,from=opentracing-lib,target=/tmp/ot/ \
227226
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
227+
--mount=type=bind,from=nginx-files,src=app-protect-security-updates.key,target=/tmp/app-protect-security-updates.key \
228228
--mount=type=bind,from=nginx-files,src=90pkgs-nginx,target=/etc/apt/apt.conf.d/90pkgs-nginx \
229229
--mount=type=bind,from=nginx-files,src=debian-plus-12.sources,target=/etc/apt/sources.list.d/nginx-plus.sources \
230230
apt-get update \
231231
&& apt-get install --no-install-recommends --no-install-suggests -y gpg ca-certificates libcap2-bin libcurl4 \
232232
&& groupadd --system --gid 101 nginx \
233233
&& useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
234234
&& gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg /tmp/nginx_signing.key \
235+
&& gpg --dearmor -o /usr/share/keyrings/app-protect-archive-keyring.gpg /tmp/app-protect-security-updates.key \
235236
&& apt-get update \
236237
&& apt-get install --no-install-recommends --no-install-suggests -y nginx-plus nginx-plus-module-njs nginx-plus-module-opentracing nginx-plus-module-fips-check \
237238
&& apt-get purge --auto-remove -y gpg \
@@ -241,7 +242,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
241242

242243

243244
############################################# Base image for Debian with NGINX Plus and App Protect WAF/DoS #############################################
244-
FROM debian:11-slim@sha256:acc5810124f0929ab44fc7913c0ad936b074cbd3eadf094ac120190862ba36c4 as debian-plus-nap
245+
FROM debian-plus as debian-plus-nap
245246
ARG NAP_MODULES
246247
ARG NGINX_AGENT
247248
ARG NGINX_PLUS_VERSION
@@ -252,59 +253,37 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
252253
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
253254
--mount=type=bind,from=opentracing-lib,target=/tmp/ot/ \
254255
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
255-
--mount=type=bind,from=nginx-files,src=app-protect-security-updates.key,target=/tmp/app-protect-security-updates.key \
256256
--mount=type=bind,from=nginx-files,src=90pkgs-nginx,target=/etc/apt/apt.conf.d/90pkgs-nginx \
257-
--mount=type=bind,from=nginx-files,src=debian-plus-11.sources,target=/etc/apt/sources.list.d/nginx-plus.sources \
258-
--mount=type=bind,from=nginx-files,src=nap-waf-11.sources,target=/tmp/app-protect.sources \
259-
--mount=type=bind,from=nginx-files,src=nap-dos-11.sources,target=/tmp/app-protect-dos.sources \
260-
--mount=type=bind,from=nginx-files,src=debian-agent-11.sources,target=/etc/apt/sources.list.d/nginx-agent.sources \
257+
--mount=type=bind,from=nginx-files,src=nap-waf-12.sources,target=/tmp/app-protect.sources \
258+
--mount=type=bind,from=nginx-files,src=nap-dos-12.sources,target=/tmp/app-protect-dos.sources \
259+
--mount=type=bind,from=nginx-files,src=debian-agent-12.sources,target=/etc/apt/sources.list.d/nginx-agent.sources \
261260
--mount=type=bind,from=nginx-files,src=agent.sh,target=/usr/local/bin/agent.sh \
262261
--mount=type=bind,from=nginx-files,src=nap-waf.sh,target=/usr/local/bin/nap-waf.sh \
263262
--mount=type=bind,from=nginx-files,src=nap-dos.sh,target=/usr/local/bin/nap-dos.sh \
264-
## the code below is duplicated from the debian-plus image because NAP doesn't support debian 12
265263
if [ -z "${NAP_MODULES##*waf*}" ]; then \
266264
cp /tmp/app-protect.sources /etc/apt/sources.list.d/app-protect.sources; \
267265
fi \
268266
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
269267
cp /tmp/app-protect-dos.sources /etc/apt/sources.list.d/app-protect-dos.sources; \
270268
fi \
271269
&& apt-get update \
272-
&& apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gpg \
273-
&& groupadd --system --gid 101 nginx \
274-
&& useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
275-
&& gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg /tmp/nginx_signing.key \
276-
&& gpg --dearmor -o /usr/share/keyrings/app-protect-archive-keyring.gpg /tmp/app-protect-security-updates.key \
277-
&& apt-get update \
278-
&& apt-get install --no-install-recommends --no-install-suggests -y nginx-plus nginx-plus-module-njs nginx-plus-module-opentracing nginx-plus-module-fips-check libcap2-bin libcurl4 \
279-
## end of duplicated code
280270
&& if [ "${NGINX_AGENT}" = "true" ]; then apt-get install --no-install-recommends --no-install-suggests -y nginx-agent; fi \
281271
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
282272
apt-get install --no-install-recommends --no-install-suggests -y app-protect app-protect-attack-signatures app-protect-threat-campaigns; \
283273
fi \
284274
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
285275
apt-get install --no-install-recommends --no-install-suggests -y app-protect-dos; \
286276
fi \
287-
&& apt-get purge --auto-remove -y gpg \
288-
## the code below is duplicated from the debian-plus image because NAP doesn't support debian 12
289-
&& cp -av /tmp/ot/usr/local/lib/libjaegertracing*so* /tmp/ot/usr/local/lib/libzipkin*so* /tmp/ot/usr/local/lib/libdd*so* /tmp/ot/usr/local/lib/libyaml*so* /usr/local/lib/ \
290-
&& ldconfig \
291-
## end of duplicated code
292277
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
293278
rm -f /etc/apt/sources.list.d/app-protect.sources; \
294279
fi \
295280
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
296281
rm -f /etc/apt/sources.list.d/app-protect-dos.sources; \
297282
fi \
298283
&& rm -rf /var/lib/apt/lists/* \
299-
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
300-
nap-waf.sh \
301-
&& if [ "${NGINX_AGENT}" = "true" ]; then \
302-
agent.sh \
303-
; fi \
304-
; fi \
305-
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
306-
nap-dos.sh \
307-
; fi
284+
&& if [ -z "${NAP_MODULES##*waf*}" ]; then nap-waf.sh; fi \
285+
&& if [ "${NGINX_AGENT}" = "true" ]; then agent.sh; fi \
286+
&& if [ -z "${NAP_MODULES##*dos*}" ]; then nap-dos.sh; fi
308287

309288
############################################# Base image for Debian with NGINX Plus and App Protect WAFv5/DoS #############################################
310289
FROM debian-plus as debian-plus-nap-v5
@@ -320,7 +299,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
320299
--mount=type=bind,from=nginx-files,src=nap-waf-v5-12.sources,target=/tmp/app-protect.sources \
321300
--mount=type=bind,from=nginx-files,src=agent.sh,target=/usr/local/bin/agent.sh \
322301
--mount=type=bind,from=nginx-files,src=nap-waf.sh,target=/usr/local/bin/nap-waf.sh \
323-
--mount=type=bind,from=nginx-files,src=debian-agent-11.sources,target=/etc/apt/sources.list.d/nginx-agent.sources \
302+
--mount=type=bind,from=nginx-files,src=debian-agent-12.sources,target=/etc/apt/sources.list.d/nginx-agent.sources \
324303
if [ -z "${NAP_MODULES##*waf*}" ]; then \
325304
cp /tmp/app-protect.sources /etc/apt/sources.list.d/app-protect.sources; \
326305
fi \

0 commit comments

Comments
 (0)