Skip to content

Commit 79d430e

Browse files
committed
update debian nap waf/dos image to debian:12
1 parent b0a36f4 commit 79d430e

File tree

1 file changed

+12
-33
lines changed

1 file changed

+12
-33
lines changed

build/Dockerfile

Lines changed: 12 additions & 33 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 \
@@ -211,13 +210,15 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
211210
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
212211
--mount=type=bind,from=opentracing-lib,target=/tmp/ot/ \
213212
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
213+
--mount=type=bind,from=nginx-files,src=app-protect-security-updates.key,target=/tmp/app-protect-security-updates.key \
214214
--mount=type=bind,from=nginx-files,src=90pkgs-nginx,target=/etc/apt/apt.conf.d/90pkgs-nginx \
215215
--mount=type=bind,from=nginx-files,src=debian-plus-12.sources,target=/etc/apt/sources.list.d/nginx-plus.sources \
216216
apt-get update \
217217
&& apt-get install --no-install-recommends --no-install-suggests -y gpg ca-certificates libcap2-bin libcurl4 \
218218
&& groupadd --system --gid 101 nginx \
219219
&& useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
220220
&& gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg /tmp/nginx_signing.key \
221+
&& gpg --dearmor -o /usr/share/keyrings/app-protect-archive-keyring.gpg /tmp/app-protect-security-updates.key \
221222
&& apt-get update \
222223
&& 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 \
223224
&& apt-get purge --auto-remove -y gpg \
@@ -227,67 +228,45 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
227228

228229

229230
############################################# Base image for Debian with NGINX Plus and App Protect WAF/DoS #############################################
230-
FROM debian:11-slim@sha256:acc5810124f0929ab44fc7913c0ad936b074cbd3eadf094ac120190862ba36c4 as debian-plus-nap
231+
FROM debian-plus as debian-plus-nap
231232
ARG NAP_MODULES
232233
ARG NGINX_AGENT
233234

234235
RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
235236
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
236237
--mount=type=bind,from=opentracing-lib,target=/tmp/ot/ \
237238
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
238-
--mount=type=bind,from=nginx-files,src=app-protect-security-updates.key,target=/tmp/app-protect-security-updates.key \
239239
--mount=type=bind,from=nginx-files,src=90pkgs-nginx,target=/etc/apt/apt.conf.d/90pkgs-nginx \
240-
--mount=type=bind,from=nginx-files,src=debian-plus-11.sources,target=/etc/apt/sources.list.d/nginx-plus.sources \
241-
--mount=type=bind,from=nginx-files,src=nap-waf-11.sources,target=/tmp/app-protect.sources \
242-
--mount=type=bind,from=nginx-files,src=nap-dos-11.sources,target=/tmp/app-protect-dos.sources \
243-
--mount=type=bind,from=nginx-files,src=debian-agent-11.sources,target=/etc/apt/sources.list.d/nginx-agent.sources \
240+
--mount=type=bind,from=nginx-files,src=nap-waf-12.sources,target=/tmp/app-protect.sources \
241+
--mount=type=bind,from=nginx-files,src=nap-dos-12.sources,target=/tmp/app-protect-dos.sources \
242+
--mount=type=bind,from=nginx-files,src=debian-agent-12.sources,target=/etc/apt/sources.list.d/nginx-agent.sources \
244243
--mount=type=bind,from=nginx-files,src=agent.sh,target=/usr/local/bin/agent.sh \
245244
--mount=type=bind,from=nginx-files,src=nap-waf.sh,target=/usr/local/bin/nap-waf.sh \
246245
--mount=type=bind,from=nginx-files,src=nap-dos.sh,target=/usr/local/bin/nap-dos.sh \
247-
## the code below is duplicated from the debian-plus image because NAP doesn't support debian 12
248246
if [ -z "${NAP_MODULES##*waf*}" ]; then \
249247
cp /tmp/app-protect.sources /etc/apt/sources.list.d/app-protect.sources; \
250248
fi \
251249
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
252250
cp /tmp/app-protect-dos.sources /etc/apt/sources.list.d/app-protect-dos.sources; \
253251
fi \
254252
&& apt-get update \
255-
&& apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gpg \
256-
&& groupadd --system --gid 101 nginx \
257-
&& useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
258-
&& gpg --dearmor -o /usr/share/keyrings/nginx-archive-keyring.gpg /tmp/nginx_signing.key \
259-
&& gpg --dearmor -o /usr/share/keyrings/app-protect-archive-keyring.gpg /tmp/app-protect-security-updates.key \
260-
&& apt-get update \
261-
&& 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 \
262-
## end of duplicated code
263253
&& if [ "${NGINX_AGENT}" = "true" ]; then apt-get install --no-install-recommends --no-install-suggests -y nginx-agent; fi \
264254
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
265255
apt-get install --no-install-recommends --no-install-suggests -y app-protect app-protect-attack-signatures app-protect-threat-campaigns; \
266256
fi \
267257
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
268258
apt-get install --no-install-recommends --no-install-suggests -y app-protect-dos; \
269259
fi \
270-
&& apt-get purge --auto-remove -y gpg \
271-
## the code below is duplicated from the debian-plus image because NAP doesn't support debian 12
272-
&& 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/ \
273-
&& ldconfig \
274-
## end of duplicated code
275260
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
276261
rm -f /etc/apt/sources.list.d/app-protect.sources; \
277262
fi \
278263
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
279264
rm -f /etc/apt/sources.list.d/app-protect-dos.sources; \
280265
fi \
281266
&& rm -rf /var/lib/apt/lists/* \
282-
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
283-
nap-waf.sh \
284-
&& if [ "${NGINX_AGENT}" = "true" ]; then \
285-
agent.sh \
286-
; fi \
287-
; fi \
288-
&& if [ -z "${NAP_MODULES##*dos*}" ]; then \
289-
nap-dos.sh \
290-
; fi
267+
&& if [ -z "${NAP_MODULES##*waf*}" ]; then nap-waf.sh; fi \
268+
&& if [ "${NGINX_AGENT}" = "true" ]; then agent.sh; fi \
269+
&& if [ -z "${NAP_MODULES##*dos*}" ]; then nap-dos.sh; fi
291270

292271
############################################# Base image for Debian with NGINX Plus and App Protect WAFv5/DoS #############################################
293272
FROM debian-plus as debian-plus-nap-v5

0 commit comments

Comments
 (0)