@@ -3,6 +3,7 @@ ARG BUILD_OS=debian
33ARG NGINX_PLUS_VERSION=r26
44ARG UBI_VERSION=8
55ARG FILES=
6+ ARG DEBIAN_VERSION=bullseye-slim
67
78# ############################################ Base image for Debian #############################################
89FROM nginx:1.21.6 AS debian
@@ -22,33 +23,36 @@ RUN apk add --no-cache libcap \
2223
2324
2425# ############################################ Base image for Alpine with NGINX Plus #############################################
25- FROM alpine:3.13 as alpine-plus
26+ FROM alpine:3.15 as alpine-plus
2627ARG NGINX_PLUS_VERSION
2728
2829RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/apk/cert.pem,mode=0644 \
2930 --mount=type=secret,id=nginx-repo.key,dst=/etc/apk/cert.key,mode=0644 \
3031 wget -nv -O /etc/apk/keys/nginx_signing.rsa.pub https://cs.nginx.com/static/keys/nginx_signing.rsa.pub \
3132 && printf "%s\n " "https://pkgs.nginx.com/plus/alpine/v$(grep -E -o '^[0-9]+\. [0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
33+ # temp fix for CVE-2022-0778
34+ && apk upgrade --no-cache libretls \
3235 && apk add --no-cache libcap nginx-plus~${NGINX_PLUS_VERSION#r} nginx-plus-module-njs~${NGINX_PLUS_VERSION#r}
3336
3437
3538# ############################################ Base image for Debian with NGINX Plus #############################################
36- FROM debian:buster-slim AS debian-plus
39+ FROM debian:${DEBIAN_VERSION} AS debian-plus
3740ARG IC_VERSION
3841ARG NGINX_PLUS_VERSION
42+ ARG BUILD_OS
3943
4044SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
4145RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
4246 --mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
4347 apt-get update \
4448 && apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg curl apt-transport-https libcap2-bin \
45- && curl -sSL https://cs.nginx.com/static/keys/nginx_signing.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_signing.gpg \
46- && curl -sSL -o /etc/apt/apt.conf.d/90pkgs-nginx https://cs.nginx.com/static/files/90pkgs-nginx \
49+ && curl -fsSL https://cs.nginx.com/static/keys/nginx_signing.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_signing.gpg \
50+ && curl -fsSL -o /etc/apt/apt.conf.d/90pkgs-nginx https://cs.nginx.com/static/files/90pkgs-nginx \
51+ && DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release) \
4752 && printf "%s\n " "Acquire::https::pkgs.nginx.com::User-Agent \" k8s-ic-$IC_VERSION${BUILD_OS##debian-plus}-apt\" ;" >> /etc/apt/apt.conf.d/90pkgs-nginx \
48- && printf "%s\n " "deb https://pkgs.nginx.com/plus/${NGINX_PLUS_VERSION^^}/debian buster nginx-plus" > /etc/apt/sources.list.d/nginx-plus.list \
53+ && printf "%s\n " "deb https://pkgs.nginx.com/plus/${NGINX_PLUS_VERSION^^}/debian ${DEBIAN_VERSION} nginx-plus" > /etc/apt/sources.list.d/nginx-plus.list \
4954 && apt-get update \
50- && apt-get install --no-install-recommends --no-install-suggests -y \
51- nginx-plus-${NGINX_PLUS_VERSION} nginx-plus-module-njs-${NGINX_PLUS_VERSION} \
55+ && apt-get install --no-install-recommends --no-install-suggests -y nginx-plus nginx-plus-module-njs \
5256 && apt-get purge --auto-remove -y apt-transport-https gnupg curl \
5357 && rm -rf /var/lib/apt/lists/*
5458
@@ -62,14 +66,12 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
6266 --mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \
6367 apt-get update \
6468 && apt-get install --no-install-recommends --no-install-suggests -y gnupg curl apt-transport-https \
65- && curl -sSL https://cs.nginx.com/static/keys/app-protect-security-updates.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_app_signing.gpg \
69+ && curl -fsSL https://cs.nginx.com/static/keys/app-protect-security-updates.key | gpg --dearmor > /etc/apt/trusted.gpg.d/nginx_app_signing.gpg \
70+ && DEBIAN_VERSION=$(awk -F '=' '/^VERSION_CODENAME=/ {print $2}' /etc/os-release) \
6671 && printf "%s\n " "deb https://pkgs.nginx.com/app-protect/${NGINX_PLUS_VERSION^^}/debian buster nginx-plus" \
67- "deb https://pkgs.nginx.com/app-protect-security-updates/debian buster nginx-plus" > /etc/apt/sources.list.d/nginx-app-protect.list \
72+ "deb https://pkgs.nginx.com/app-protect-security-updates/debian ${DEBIAN_VERSION} nginx-plus" > /etc/apt/sources.list.d/nginx-app-protect.list \
6873 && apt-get update \
69- # searching apt-cache for the latest version of NAP package compatible with the $NGINX_PLUS_VERSION
70- && module_version=$(apt-cache showpkg nginx-plus-module-appprotect | awk -v ver="nginx-plus-$NGINX_PLUS_VERSION" '{ if ($6 == ver) {print $1; exit}}' ) \
71- && apt-get install --no-install-recommends --no-install-suggests -y nginx-plus-module-appprotect=${module_version} app-protect=${module_version} \
72- && apt-get install --no-install-recommends --no-install-suggests -y app-protect-attack-signatures app-protect-threat-campaigns \
74+ && apt-get install --no-install-recommends --no-install-suggests -y app-protect app-protect-attack-signatures app-protect-threat-campaigns \
7375 && apt-get purge --auto-remove -y apt-transport-https gnupg curl \
7476 && rm -rf /var/lib/apt/lists/* \
7577 && rm /etc/apt/sources.list.d/nginx-app-protect.list
0 commit comments