@@ -56,7 +56,7 @@ LABEL name="NGINX Ingress Controller" \
56
56
COPY --link --chown=101:0 LICENSE /licenses/
57
57
58
58
59
- # ############################################ NGINX files for NGINX Plus #############################################
59
+ # ############################################ NGINX files #############################################
60
60
FROM scratch AS nginx-files
61
61
ARG IC_VERSION
62
62
ARG BUILD_OS
@@ -94,6 +94,8 @@ ADD --link --chown=101:0 --chmod=0755 build/scripts/common.sh common.sh
94
94
ADD --link --chown=101:0 --chmod=0755 build/scripts/nap-waf.sh nap-waf.sh
95
95
ADD --link --chown=101:0 --chmod=0755 build/scripts/nap-dos.sh nap-dos.sh
96
96
ADD --link --chown=101:0 --chmod=0755 build/scripts/agent.sh agent.sh
97
+ ADD --link --chown=101:0 --chmod=0755 build/scripts/ubi-setup.sh ubi-setup.sh
98
+ ADD --link --chown=101:0 --chmod=0755 build/scripts/ubi-clean.sh ubi-clean.sh
97
99
98
100
99
101
# ############################################ Patch Image #############################################
@@ -327,14 +329,11 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
327
329
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
328
330
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
329
331
--mount=type=bind,from=nginx-files,src=nginx-plus-9.repo,target=/etc/yum.repos.d/nginx-plus.repo \
330
- microdnf --nodocs install -y shadow-utils \
331
- && cat /etc/yum.repos.d/nginx-plus.repo \
332
- && groupadd --system --gid 101 nginx \
333
- && useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
334
- && rpm --import /tmp/nginx_signing.key \
332
+ --mount=type=bind,from=nginx-files,src=ubi-setup.sh,target=/usr/local/bin/ubi-setup.sh \
333
+ --mount=type=bind,from=nginx-files,src=ubi-clean.sh,target=/usr/local/bin/ubi-clean.sh \
334
+ ubi-setup.sh \
335
335
&& microdnf --nodocs install -y nginx-plus nginx-plus-module-njs nginx-plus-module-fips-check \
336
- && microdnf remove -y shadow-utils \
337
- && microdnf clean all
336
+ && ubi-clean.sh
338
337
339
338
340
339
# ############################################ Base image for UBI with NGINX Plus and App Protect WAF #############################################
@@ -355,12 +354,12 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
355
354
--mount=type=bind,from=nginx-files,src=app-protect-9.repo,target=/tmp/app-protect-9.repo \
356
355
--mount=type=bind,from=nginx-files,src=agent.sh,target=/usr/local/bin/agent.sh \
357
356
--mount=type=bind,from=nginx-files,src=nap-waf.sh,target=/usr/local/bin/nap-waf.sh \
357
+ --mount=type=bind,from=nginx-files,src=ubi-setup.sh,target=/usr/local/bin/ubi-setup.sh \
358
+ --mount=type=bind,from=nginx-files,src=ubi-clean.sh,target=/usr/local/bin/ubi-clean.sh \
358
359
source /tmp/rhel_license \
359
360
&& rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
360
- && microdnf --nodocs install -y shadow-utils ca-certificates subscription-manager \
361
- && groupadd --system --gid 101 nginx \
362
- && useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
363
- && rpm --import /tmp/nginx_signing.key \
361
+ && microdnf --nodocs install -y ca-certificates \
362
+ && ubi-setup.sh \
364
363
&& microdnf --nodocs install -y nginx-plus nginx-plus-module-njs nginx-plus-module-fips-check \
365
364
&& if [ "${NGINX_AGENT}" = "true" ]; then microdnf --nodocs install -y nginx-agent; fi \
366
365
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} || true \
@@ -374,8 +373,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
374
373
&& nap-waf.sh \
375
374
; fi \
376
375
&& subscription-manager unregister \
377
- && microdnf remove -y shadow-utils subscription-manager \
378
- && microdnf clean all && rm -rf /var/cache/dnf \
376
+ && ubi-clean.sh \
379
377
&& if [ "${NGINX_AGENT}" = "true" ]; then \
380
378
agent.sh \
381
379
; fi
@@ -398,12 +396,12 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
398
396
--mount=type=bind,from=nginx-files,src=app-protect-v5-9.repo,target=/tmp/app-protect-9.repo \
399
397
--mount=type=bind,from=nginx-files,src=agent.sh,target=/usr/local/bin/agent.sh \
400
398
--mount=type=bind,from=nginx-files,src=nap-waf.sh,target=/usr/local/bin/nap-waf.sh \
399
+ --mount=type=bind,from=nginx-files,src=ubi-setup.sh,target=/usr/local/bin/ubi-setup.sh \
400
+ --mount=type=bind,from=nginx-files,src=ubi-clean.sh,target=/usr/local/bin/ubi-clean.sh \
401
401
source /tmp/rhel_license \
402
402
&& rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \
403
- && microdnf --nodocs install -y shadow-utils ca-certificates subscription-manager \
404
- && groupadd --system --gid 101 nginx \
405
- && useradd --system --gid nginx --no-create-home --home-dir /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
406
- && rpm --import /tmp/nginx_signing.key \
403
+ && microdnf --nodocs install -y ca-certificates \
404
+ && ubi-setup.sh \
407
405
&& microdnf --nodocs install -y nginx-plus nginx-plus-module-njs nginx-plus-module-fips-check \
408
406
&& if [ "${NGINX_AGENT}" = "true" ]; then microdnf --nodocs install -y nginx-agent; fi \
409
407
&& subscription-manager register --org=${RHEL_ORGANIZATION} --activationkey=${RHEL_ACTIVATION_KEY} || true \
@@ -419,8 +417,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
419
417
&& rm -f /etc/yum.repos.d/app-protect-9.repo; \
420
418
fi \
421
419
&& subscription-manager unregister \
422
- && microdnf remove -y shadow-utils subscription-manager \
423
- && microdnf clean all && rm -rf /var/cache/dnf \
420
+ && ubi-clean.sh \
424
421
&& if [ "${NGINX_AGENT}" = "true" ]; then \
425
422
agent.sh; \
426
423
fi
0 commit comments