Skip to content

Commit d737289

Browse files
committed
build c-ares packages on UBI for Otel module
1 parent 95f43bb commit d737289

File tree

4 files changed

+32
-107
lines changed

4 files changed

+32
-107
lines changed
Lines changed: 12 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,36 @@
1-
name: Build UBI ppc64le Dependency
1+
name: Build UBI c-ares Dependency
22

33
on:
44
push:
55
branches:
66
- main
7+
- feat/add-otel-support
78
paths:
8-
- build/dependencies/Dockerfile.ubi
9+
- build/dependencies/Dockerfile.ubi8
10+
- build/dependencies/Dockerfile.ubi9
911
workflow_dispatch:
10-
inputs:
11-
nginx_version:
12-
type: string
13-
description: "NGINX Version to build for"
14-
required: false
15-
force:
16-
type: boolean
17-
description: "Force rebuild"
18-
required: false
19-
default: false
2012

2113
env:
22-
IMAGE_NAME: ghcr.io/nginx/dependencies/nginx-ubi-ppc64le
14+
IMAGE_NAME: ghcr.io/nginx/dependencies/nginx-ubi
2315

2416
concurrency:
25-
group: ${{ github.ref_name }}-ubi-ppc64le-build
17+
group: ${{ github.ref_name }}-ubi-build
2618
cancel-in-progress: true
2719

2820
permissions:
2921
contents: read
3022

3123
jobs:
32-
checks:
33-
name: Check versions
34-
runs-on: ubuntu-22.04
35-
permissions:
36-
packages: read
37-
contents: read
38-
strategy:
39-
fail-fast: false
40-
outputs:
41-
nginx_version: ${{ steps.var.outputs.nginx_version }}
42-
njs_version: ${{ steps.var.outputs.njs_version }}
43-
target_exists: ${{ steps.var.outputs.target_image_exists }}
44-
steps:
45-
- name: Checkout Repository
46-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47-
48-
- name: Login to GitHub Container Registry
49-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
50-
with:
51-
registry: ghcr.io
52-
username: ${{ github.repository_owner }}
53-
password: ${{ secrets.GITHUB_TOKEN }}
54-
55-
- name: Output Variables
56-
id: var
57-
run: |
58-
if [ -n "${{ inputs.nginx_version }}" ]; then
59-
nginx_v=${{ inputs.nginx_version }}
60-
else
61-
nginx_v=$(grep -m1 'FROM nginx:' <build/dependencies/Dockerfile.ubi | cut -d '@' -f1 | awk -F'[: ]' '{print $3}')
62-
fi
63-
target_image=${{ env.IMAGE_NAME }}:nginx-${nginx_v}
64-
if docker manifest inspect ${target_image}; then
65-
target_image_exists=true
66-
else
67-
target_image_exists=false
68-
fi
69-
docker pull nginx:$nginx_v || exit 1
70-
njs=$(docker run nginx:$nginx_v env | grep NJS_VERSION | cut -d= -f2)
71-
echo "> Outputs -------------------------------"
72-
echo "NJS_VERSION=$njs"
73-
echo "nginx_version=${nginx_v}"
74-
echo "njs_version=${njs}"
75-
echo "target_image_exists=${target_image_exists}"
76-
echo "nginx_version=${nginx_v}" >> $GITHUB_OUTPUT
77-
echo "njs_version=${njs}" >> $GITHUB_OUTPUT
78-
echo "target_image_exists=${target_image_exists}" >> $GITHUB_OUTPUT
79-
8024
build-binaries:
8125
name: Build Binary Container Image
82-
if: ${{ needs.checks.outputs.target_exists != 'true' || inputs.force }}
83-
needs: checks
8426
runs-on: ubuntu-22.04
8527
permissions:
8628
packages: write
8729
contents: read
8830
strategy:
8931
fail-fast: false
32+
matrix:
33+
tag: ["ubi8", "ubi9"]
9034
steps:
9135
- name: Checkout Repository
9236
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -113,28 +57,22 @@ jobs:
11357
images: |
11458
name=${{ env.IMAGE_NAME }},enable=true
11559
tags: |
116-
type=raw,value=nginx-${{ needs.checks.outputs.nginx_version }},enable=true
60+
type=raw,value=${{ matrix.tag }},enable=true
11761
env:
11862
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
11963

12064
- name: Build and push
12165
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v6.16.0
12266
with:
123-
file: ./build/dependencies/Dockerfile.ubi
67+
file: ./build/dependencies/Dockerfile.${{ matrix.tag }}
12468
context: "."
12569
pull: true
126-
push: true
127-
# build multi-arch so that it can be mounted from any image
128-
# even though only ppc64le will contain binaries
12970
platforms: "linux/amd64,linux/arm64"
13071
tags: ${{ steps.meta.outputs.tags }}
13172
labels: ${{ steps.meta.outputs.labels }}
13273
annotations: ${{ steps.meta.outputs.annotations }}
133-
cache-from: type=gha,scope=nginx-ubi-ppc64le
134-
cache-to: type=gha,scope=nginx-ubi-ppc64le,mode=max
74+
cache-from: type=gha,scope=nginx-${{ matrix.tag }}
75+
cache-to: type=gha,scope=nginx-${{ matrix.tag }},mode=max
13576
target: final
13677
sbom: false
13778
provenance: mode=max
138-
build-args: |
139-
NGINX=${{ needs.checks.outputs.nginx_version }}
140-
NJS=${{ needs.checks.outputs.njs_version }}

build/dependencies/Dockerfile.ubi

Lines changed: 0 additions & 33 deletions
This file was deleted.

build/dependencies/Dockerfile.ubi8

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# syntax=docker/dockerfile:1.8
2+
FROM redhat/ubi8@sha256:244e9858f9d8a2792a3dceb850b4fa8fdbd67babebfde42587bfa919d5d1ecef AS rpm-build
3+
RUN mkdir -p /rpms/ \
4+
&& dnf install rpm-build gcc make cmake -y \
5+
&& rpmbuild --rebuild --nodebuginfo https://mirror.stream.centos.org/9-stream/BaseOS/source/tree/Packages/c-ares-1.19.1-1.el9.src.rpm \
6+
&& cp /root/rpmbuild/RPMS/$(arch)/* /rpms/ \
7+
&& rm -rf /rpms/*devel*
8+
9+
FROM scratch AS final
10+
COPY --link --from=rpm-build /rpms /

build/dependencies/Dockerfile.ubi9

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# syntax=docker/dockerfile:1.8
2+
FROM redhat/ubi9:9.5@sha256:d07a5e080b8a9b3624d3c9cfbfada9a6baacd8e6d4065118f0e80c71ad518044 AS rpm-build
3+
RUN mkdir -p /rpms/ \
4+
&& dnf install rpm-build gcc make cmake -y \
5+
&& rpmbuild --rebuild --nodebuginfo https://mirror.stream.centos.org/9-stream/BaseOS/source/tree/Packages/c-ares-1.19.1-1.el9.src.rpm \
6+
&& cp /root/rpmbuild/RPMS/$(arch)/* /rpms/ \
7+
&& rm -rf /rpms/*devel*
8+
9+
FROM scratch AS final
10+
COPY --link --from=rpm-build /rpms /

0 commit comments

Comments
 (0)