Skip to content

Commit

Permalink
build UBI s390x nginx package for OSS images (#6846)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdabelf5 authored Nov 22, 2024
1 parent 6007227 commit cab70d7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-ubi-dependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
paths:
- build/dependencies/Dockerfile.ubi-ppc64le
- build/dependencies/Dockerfile.ubi
workflow_dispatch:
inputs:
nginx_version:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
if [ -n "${{ inputs.nginx_version }}" ]; then
nginx_v=${{ inputs.nginx_version }}
else
nginx_v=$(grep -m1 'FROM nginx:' <build/dependencies/Dockerfile.ubi-ppc64le | cut -d '@' -f1 | awk -F'[: ]' '{print $3}')
nginx_v=$(grep -m1 'FROM nginx:' <build/dependencies/Dockerfile.ubi | cut -d '@' -f1 | awk -F'[: ]' '{print $3}')
fi
target_image=${{ env.IMAGE_NAME }}:nginx-${nginx_v}
if docker manifest inspect ${target_image}; then
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
file: ./build/dependencies/Dockerfile.ubi-ppc64le
file: ./build/dependencies/Dockerfile.ubi
context: "."
pull: true
push: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-docker-sha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
ARGS="--exclude ${{ github.event.inputs.excludes }}"
fi
.github/scripts/docker-updater.sh ./build/Dockerfile $ARGS
.github/scripts/docker-updater.sh ./build/dependencies/Dockerfile.ubi-ppc64le $ARGS
.github/scripts/docker-updater.sh ./build/dependencies/Dockerfile.ubi $ARGS
.github/scripts/docker-updater.sh ./tests/Dockerfile $ARGS
files=$(git diff --name-only)
if [[ $files == *"Dockerfile"* ]]; then
Expand Down
18 changes: 9 additions & 9 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ARG PACKAGE_REPO=pkgs.nginx.com
############################################# Base images containing libs for Opentracing and FIPS #############################################
FROM ghcr.io/nginxinc/dependencies/nginx-ot:nginx-1.27.2@sha256:022d9c1e36caedfb502d6ac56b6b8e40977be73517f61f1b525686dec147355d AS opentracing-lib
FROM ghcr.io/nginxinc/dependencies/nginx-ot:nginx-1.27.2-alpine@sha256:7379ceee1ffc21669312a3e882ecd504e14a7f30bdc9bcfdc632030ea3777b0a AS alpine-opentracing-lib
FROM ghcr.io/nginxinc/dependencies/nginx-ubi-ppc64le:nginx-1.27.2@sha256:6288dc0ec71dfcacfbe3578bb0731c03e7e012956e5b01393d28650df54d9b9e AS ubi-ppc64le
FROM ghcr.io/nginxinc/dependencies/nginx-ubi-ppc64le:nginx-1.27.2@sha256:4c47c1295b25018342d9f7c8383fd933e73e162a482f2f45a21326f70c6d501d AS ubi-ppc64le
FROM ghcr.io/nginxinc/alpine-fips:0.2.3-alpine3.17@sha256:67b69b49aff96e185be841e2b2ff2d8236551ea5c18002bffa4344798d803fd8 AS alpine-fips-3.17
FROM ghcr.io/nginxinc/alpine-fips:0.2.3-alpine3.20@sha256:4c29e5c50b122354d9d4ba6b97cdf64647468e788b965fc0240ead541653454a AS alpine-fips-3.20
FROM redhat/ubi9-minimal@sha256:c0e70387664f30cd9cf2795b547e4a9a51002c44a4a86aa9335ab030134bf392 AS ubi-minimal
Expand Down Expand Up @@ -300,7 +300,7 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode
&& apt-get update \
&& if [ "${NGINX_AGENT}" = "true" ]; then apt-get install --no-install-recommends --no-install-suggests -y nginx-agent; fi \
&& if [ -z "${NAP_MODULES##*waf*}" ]; then \
apt-get install --no-install-recommends --no-install-suggests -y app-protect-module-plus=32+5.144*; \
apt-get install --no-install-recommends --no-install-suggests -y app-protect-plugin=6.3.0* app-protect-module-plus=32+5.144* nginx-plus-module-appprotect=32+5.144*; \
rm -f /etc/apt/sources.list.d/app-protect.sources; \
nap-waf.sh; \
fi \
Expand Down Expand Up @@ -332,20 +332,20 @@ RUN --mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_s
--mount=type=bind,from=nginx-files,src=ubi-clean.sh,target=/usr/local/bin/ubi-clean.sh \
--mount=type=bind,from=ubi-ppc64le,src=/,target=/ubi-bin/ \
ubi-setup.sh; \
if [ $(uname -p) != ppc64le ]; then \
printf "%s\n" "[nginx]" "name=nginx repo" \
"baseurl=https://nginx.org/packages/mainline/centos/9/\$basearch/" \
"gpgcheck=1" "enabled=1" "module_hotfixes=true" > /etc/yum.repos.d/nginx.repo \
&& microdnf --nodocs install -y nginx nginx-module-njs nginx-module-image-filter nginx-module-xslt \
&& rm /etc/yum.repos.d/nginx.repo; \
else \
if [ $(uname -p) = ppc64le ] || [ $(uname -p) = s390x ]; then \
rpm -qa --queryformat "%{NAME}\n" | sort > pkgs-installed \
&& microdnf --nodocs --setopt=install_weak_deps=0 install -y diffutils dnf \
&& rpm -qa --queryformat "%{NAME}\n" | sort > pkgs-new \
&& dnf install -y /ubi-bin/*.rpm \
&& dnf -q repoquery --resolve --requires --recursive --whatrequires nginx --queryformat "%{NAME}" > pkgs-nginx \
&& dnf --setopt=protected_packages= remove -y $(comm -13 pkgs-installed pkgs-new | comm -13 pkgs-nginx -) \
&& rm pkgs-installed pkgs-new pkgs-nginx; \
else \
printf "%s\n" "[nginx]" "name=nginx repo" \
"baseurl=https://nginx.org/packages/mainline/centos/9/\$basearch/" \
"gpgcheck=1" "enabled=1" "module_hotfixes=true" > /etc/yum.repos.d/nginx.repo \
&& microdnf --nodocs install -y nginx nginx-module-njs nginx-module-image-filter nginx-module-xslt \
&& rm /etc/yum.repos.d/nginx.repo; \
fi \
&& ubi-clean.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ ENV NJS_VERSION ${NJS}

RUN mkdir -p /nginx/; \
# only build for ppc64le but make multiarch image for mounting
[ $(uname -p) != ppc64le ] && exit 0; \
[ $(uname -p) = x86_64 ] && exit 0; \
[ $(uname -p) = aarch64 ] && exit 0; \
rpm --import https://nginx.org/keys/nginx_signing.key \
&& MINOR_VERSION=$(echo ${NGINX_VERSION} | cut -d '.' -f 2) \
&& if [ $(( $MINOR_VERSION % 2)) -eq 0 ]; then echo mainline=""; else mainline="mainline/"; fi \
Expand Down

0 comments on commit cab70d7

Please sign in to comment.