-
Notifications
You must be signed in to change notification settings - Fork 137
Update pipeline to build and publish UBI images #3958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
58d9674
Add initial Dockerfile to build NGINX OSS images based on ubi9-minimal
shaun-nx 20d131e
Update repo files and use red hat registered ubi-minimal
shaun-nx 3022205
Merge branch 'main' into feat/ubi-base-image
shaun-nx f154680
Get required UBI packages for NGINX and install agent
shaun-nx 42c4cec
Merge branch 'main' into feat/ubi-base-image
shaun-nx b880fc7
Update entrypoint to find NGINX master process. Ensure `/tmp` is writ…
shaun-nx c46e928
Merge branch 'main' into feat/ubi-base-image
shaun-nx caaf91a
Build control plane from UBI base image. Move current Alpine dockerfi…
shaun-nx 25cee52
Add Dockerfile to build NGINX Plus image based on ubi9-minimal
shaun-nx fd1498c
Fix eof errors
shaun-nx 2e9bac0
Merge branch 'feat/openshift-support' into feat/ubi-base-image
shaun-nx 85d8358
Move alpine base Dockerfiles back to build dir
shaun-nx 0f03b47
Merge branch 'feat/openshift-support' into feat/ubi-base-image
shaun-nx d28416a
Fix merge conflict
shaun-nx 523ebd1
Update labels
shaun-nx 31750dd
Update lables for plus builds
shaun-nx 7146752
Update lables to distinguish between OSS and Plus
shaun-nx e776ae1
Make NGINX Plus version configurable
shaun-nx 0746604
Update pipeline to build and publish UBI images
shaun-nx 31f0e52
Update UBI Dockerfile for NGINX Plus to use certs and keys from pipeline
shaun-nx cb75255
Ensure build_os is added as a suffix to our tags
shaun-nx c5e49a3
Update build/ubi/Dockerfile.nginx
shaun-nx bc7c10f
Update lables and remove BASE_IMAGE
shaun-nx 1c76006
Merge branch 'feat/ubi-base-image' into feat/pipeline-ubi-builds
shaun-nx 6eefb2e
Add suffix to all types in Docker meta build stage
shaun-nx cbcd7ca
Remove local reference to crt and key files
shaun-nx 4924f3c
Merge branch 'feat/ubi-base-image' into feat/pipeline-ubi-builds
shaun-nx 048c38c
Merge branch 'feat/openshift-support' into feat/ubi-base-image
shaun-nx d9155b2
Set permissions on required directories. Update lables
shaun-nx c2c0f47
Merge branch 'feat/ubi-base-image' into feat/pipeline-ubi-builds
shaun-nx 5cb3854
Add build_os to conformance and functional test matrix. Update tags f…
shaun-nx a89cc6f
Ensure unique conformance profile name based on build os
shaun-nx d71f895
Fix pre-commit errors
shaun-nx 0190c83
Update conformance profile output with additional inputs
shaun-nx c4c696f
Use ngf meta output in fonromance profile name
shaun-nx a418b6f
Update conformance test name
shaun-nx 214d789
Ensure build os is passed to functional and conformance tests
shaun-nx 42a3505
Use ngf-meta.output.version in place of build os
shaun-nx 2636921
Move base dockerfiles back to root build dir
shaun-nx be670b0
Update .github/workflows/conformance.yml
shaun-nx c1cb9bc
Update .github/workflows/functional.yml
shaun-nx 8f3d872
Update .github/workflows/conformance.yml
shaun-nx 66ce6a2
Update .github/workflows/functional.yml
shaun-nx 873d56f
Update .github/workflows/functional.yml
shaun-nx 8f1a6f7
Update .github/workflows/functional.yml
shaun-nx 168e2b0
Update Makefile
shaun-nx f653702
Merge branch 'feat/ubi-base-image' into feat/pipeline-ubi-builds
shaun-nx 00dbbc6
Ensure subscription manage and shadowutils are removed
shaun-nx 16e71b9
Merge branch 'feat/ubi-base-image' into feat/pipeline-ubi-builds
shaun-nx c08dfeb
Debug conformance test name
shaun-nx bf3f138
Add production-release as an input for functional tests
shaun-nx ff6a102
Update .github/workflows/functional.yml
shaun-nx a6a21aa
Add tag_suffix to workflow call for conformance and functional workflows
shaun-nx 6aed809
Remove tag_suffix and updated build-os variable
shaun-nx 99a75d6
Fix NFG docker meta
shaun-nx d424ca1
Fix tags and add BUILD_OS to build args
shaun-nx eb6991f
Revert makefile
shaun-nx d911c35
Eneusre right dockerfile is used at build stage
shaun-nx 54c1fa1
Fix forward-slash placement
shaun-nx 399d258
Merge branch 'feat/openshift-support' into feat/pipeline-ubi-builds
shaun-nx c1ee265
Update `cache-froma for functional and conformance tests
shaun-nx 3207622
Temp - Remove build OS from functional test. Revert back to main for …
shaun-nx 6350f68
Fix pre-commit error
shaun-nx 5590673
Add repo secrets to functional and conformance tests
shaun-nx 9f9cc89
Update `cache-from` and `cache-to` in `build.yml`
shaun-nx 4962d4b
Fix build-os naming
shaun-nx f4b6cbd
re-add secrets to functional and conformance tests
shaun-nx 07eb4c1
Update dockerfile path for functional tests
shaun-nx 699d285
Remove build os from build args
shaun-nx 4f9b51b
Remove secrets from build step
shaun-nx 8e1bd2f
test: Update both UBI dockerfiles to use `redhat/ubi9` instead of `ub…
shaun-nx e78dac2
Revert back to ubi9 minimal. test install procps-ng iproute iputils c…
shaun-nx 9f36704
Remove curl and corutils from install
shaun-nx cb5061b
Remove additioanl libraries
shaun-nx 6a9b11d
Update main temaplte to use full path to otel module
shaun-nx 481b00d
Fix unit test
shaun-nx 867c5a0
Copy modules from `/usr/lib64/nginx/modules/` to `/usr/lib/nginx/modu…
shaun-nx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# syntax=docker/dockerfile:1.18 | ||
FROM golang:1.25 AS builder | ||
|
||
WORKDIR /go/src/github.com/nginx/nginx-gateway-fabric | ||
|
||
COPY go.mod go.sum /go/src/github.com/nginx/nginx-gateway-fabric/ | ||
RUN go mod download | ||
|
||
COPY . /go/src/github.com/nginx/nginx-gateway-fabric | ||
RUN make build | ||
|
||
FROM golang:1.25 AS ca-certs-provider | ||
|
||
FROM redhat/ubi9-minimal:9.6 AS ngf-ubi-minimal | ||
# CA certs are needed for telemetry report so that NGF can verify the server's certificate. | ||
COPY --from=ca-certs-provider --link /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
USER 101:1001 | ||
ARG BUILD_AGENT | ||
ENV BUILD_AGENT=${BUILD_AGENT} | ||
ENTRYPOINT [ "/usr/bin/gateway" ] | ||
|
||
FROM ngf-ubi-minimal AS container | ||
COPY --from=builder /go/src/github.com/nginxinc/nginx-gateway-fabric/build/out/gateway /usr/bin/gateway | ||
|
||
FROM ngf-ubi-minimal AS local | ||
COPY ./build/out/gateway /usr/bin/gateway | ||
|
||
FROM ngf-ubi-minimal AS goreleaser | ||
ARG TARGETARCH | ||
COPY dist/gateway_linux_$TARGETARCH*/gateway /usr/bin/gateway |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# syntax=docker/dockerfile:1.18 | ||
FROM scratch AS nginx-files | ||
|
||
# Repository and key files for UBI-based builds | ||
ADD --link --chown=101:1001 https://nginx.org/keys/nginx_signing.key nginx_signing.key | ||
ADD --link --chown=101:1001 build/ubi/repos/nginx.repo nginx.repo | ||
ADD --link --chown=101:1001 build/ubi/repos/agent.repo agent.repo | ||
|
||
FROM redhat/ubi9-minimal:9.6 AS ubi-minimal | ||
|
||
FROM ghcr.io/nginx/dependencies/nginx-ubi:ubi9@sha256:01a32246761b9bbe47a6a29bcd8ca6e9b6e331b3bdfa372d8987b622276f7025 AS ubi9-packages | ||
|
||
FROM ubi-minimal AS ubi-nginx | ||
|
||
# renovate: datasource=github-tags depName=nginx/agent | ||
ARG NGINX_AGENT_VERSION=v3.3.1 | ||
ARG NJS_DIR | ||
ARG NGINX_CONF_DIR | ||
ARG BUILD_AGENT | ||
|
||
LABEL name="F5 NGINX Gateway Fabric NGINX" \ | ||
maintainer="[email protected]" \ | ||
vendor="F5 NGINX Inc" \ | ||
summary="F5 NGINX for NGINX Gateway Fabric" \ | ||
description="F5 NGINX data plane for NGINX Gateway Fabric Gateway API implementation" \ | ||
org.nginx.ngf.image.build.agent="${BUILD_AGENT}" \ | ||
io.k8s.description="F5 NGINX data plane for NGINX Gateway Fabric Gateway API implementation" \ | ||
io.openshift.tags="nginx,gateway,kubernetes,openshift" | ||
|
||
COPY --link --chown=101:1001 LICENSE /licenses/ | ||
|
||
# Install NGINX with OTEL support using the same approach as NGINX IC | ||
RUN --mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \ | ||
--mount=type=bind,from=nginx-files,src=nginx.repo,target=/etc/yum.repos.d/nginx.repo \ | ||
--mount=type=bind,from=nginx-files,src=agent.repo,target=/etc/yum.repos.d/agent.repo \ | ||
--mount=type=bind,from=ubi9-packages,src=/,target=/ubi-bin/ \ | ||
# Import NGINX signing key | ||
rpm --import /tmp/nginx_signing.key \ | ||
# Install c-ares from the dependencies image (contains required libs) | ||
&& rpm -Uvh /ubi-bin/c-ares-*.rpm \ | ||
# Create nginx user with consistent UID/GID | ||
&& groupadd -g 1001 nginx \ | ||
&& useradd -r -u 101 -g nginx -s /sbin/nologin -d /var/cache/nginx nginx \ | ||
# Install NGINX and modules including OTEL | ||
&& microdnf --nodocs install -y nginx nginx-module-njs nginx-module-otel \ | ||
# Install nginx-agent | ||
&& microdnf --nodocs install -y nginx-agent-${NGINX_AGENT_VERSION#v}* \ | ||
# Clean up (only remove what we can) | ||
&& microdnf clean all \ | ||
&& rm -rf /var/cache/yum | ||
|
||
# Configure directories and logging | ||
RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \ | ||
# Forward request and error logs to docker log collector | ||
&& ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log \ | ||
&& mv /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/ \ | ||
# Set proper permissions for nginx user | ||
&& chown -R 101:1001 /etc/nginx /var/cache/nginx /var/log/nginx /var/run/nginx | ||
|
||
# Copy configuration files and scripts | ||
COPY build/entrypoint.sh /agent/entrypoint.sh | ||
COPY ${NJS_DIR}/httpmatches.js /usr/lib/nginx/modules/njs/httpmatches.js | ||
COPY ${NGINX_CONF_DIR}/nginx.conf /etc/nginx/nginx.conf | ||
COPY ${NGINX_CONF_DIR}/grpc-error-locations.conf /etc/nginx/grpc-error-locations.conf | ||
COPY ${NGINX_CONF_DIR}/grpc-error-pages.conf /etc/nginx/grpc-error-pages.conf | ||
|
||
# Set executable permissions | ||
RUN chmod +x /agent/entrypoint.sh && chown 101:1001 /agent/entrypoint.sh | ||
|
||
# Switch to non-root user | ||
USER 101:1001 | ||
|
||
ENTRYPOINT ["/agent/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# syntax=docker/dockerfile:1.18 | ||
FROM scratch AS nginx-files | ||
|
||
# NGINX Plus repo and key files (must be provided at build time) | ||
ADD --link --chown=101:1001 https://cs.nginx.com/static/files/plus-9.repo nginx-plus.repo | ||
ADD --link --chown=101:1001 https://nginx.org/keys/nginx_signing.key nginx_signing.key | ||
ADD --link --chown=101:1001 build/ubi/repos/agent.repo agent.repo | ||
ADD --link --chown=101:1001 nginx-repo.crt nginx-repo.crt | ||
ADD --link --chown=101:1001 nginx-repo.key nginx-repo.key | ||
|
||
FROM redhat/ubi9-minimal:9.6 AS ubi-minimal | ||
|
||
FROM ghcr.io/nginx/dependencies/nginx-ubi:ubi9@sha256:01a32246761b9bbe47a6a29bcd8ca6e9b6e331b3bdfa372d8987b622276f7025 AS ubi9-packages | ||
|
||
FROM ubi-minimal AS ubi-nginx-plus | ||
|
||
ARG NGINX_PLUS_VERSION=R35 | ||
|
||
# renovate: datasource=github-tags depName=nginx/agent | ||
ARG NGINX_AGENT_VERSION=v3.3.1 | ||
ARG NJS_DIR | ||
ARG NGINX_CONF_DIR | ||
ARG BUILD_AGENT | ||
|
||
LABEL name="F5 NGINX Gateway Fabric NGINX Plus" \ | ||
maintainer="[email protected]" \ | ||
vendor="F5 NGINX Inc" \ | ||
summary="F5 NGINX Plus for NGINX Gateway Fabric" \ | ||
description="F5 NGINX Plus data plane for NGINX Gateway Fabric Gateway API implementation" \ | ||
org.nginx.ngf.image.build.agent="${BUILD_AGENT}" \ | ||
io.k8s.description="F5 NGINX Plus data plane for NGINX Gateway Fabric Gateway API implementation" \ | ||
io.openshift.tags="nginx,gateway,kubernetes,openshift" | ||
|
||
COPY --link --chown=101:1001 LICENSE /licenses/ | ||
|
||
# Install NGINX Plus and modules | ||
RUN --mount=type=bind,from=nginx-files,src=nginx-plus.repo,target=/etc/yum.repos.d/nginx-plus.repo \ | ||
--mount=type=bind,from=nginx-files,src=agent.repo,target=/etc/yum.repos.d/agent.repo \ | ||
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \ | ||
--mount=type=bind,from=ubi9-packages,src=/,target=/ubi-bin/ \ | ||
--mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \ | ||
--mount=type=secret,id=nginx-repo.key,dst=/etc/ssl/nginx/nginx-repo.key,mode=0644 \ | ||
# Install shadow-utils for useradd and subscription-manager for repo access | ||
microdnf --nodocs install -y shadow-utils subscription-manager \ | ||
&& rpm --import /tmp/nginx_signing.key \ | ||
# Install c-ares from the dependencies image (contains required libs) | ||
&& rpm -Uvh /ubi-bin/c-ares-*.rpm \ | ||
# Create nginx user with consistent UID/GID | ||
&& groupadd -g 1001 nginx \ | ||
&& useradd -r -u 101 -g nginx -s /sbin/nologin -d /var/cache/nginx nginx \ | ||
# Install NGINX Plus and modules (njs, otel) | ||
&& microdnf --nodocs install -y nginx-plus-${NGINX_PLUS_VERSION,,} \ | ||
&& microdnf --nodocs install -y nginx-plus-module-njs-${NGINX_PLUS_VERSION,,} nginx-plus-module-otel-${NGINX_PLUS_VERSION,,} \ | ||
# Install nginx-agent | ||
&& microdnf --nodocs install -y nginx-agent-${NGINX_AGENT_VERSION#v}* \ | ||
# Clean up | ||
&& microdnf clean all \ | ||
&& rm -rf /var/cache/yum | ||
|
||
# Configure directories and logging | ||
RUN mkdir -p /usr/lib/nginx/modules /var/run/nginx /usr/lib64/nginx/modules \ | ||
# Forward request and error logs to docker log collector | ||
&& ln -sf /dev/stdout /var/log/nginx/access.log \ | ||
&& ln -sf /dev/stderr /var/log/nginx/error.log \ | ||
&& mv /usr/lib64/nginx/modules/ngx_* /usr/lib/nginx/modules/ \ | ||
# Set proper permissions for nginx user | ||
&& chown -R 101:1001 /etc/nginx /var/cache/nginx /var/log/nginx /var/run/nginx | ||
|
||
# Copy configuration files and scripts | ||
COPY build/entrypoint.sh /agent/entrypoint.sh | ||
COPY ${NJS_DIR}/httpmatches.js /usr/lib/nginx/modules/njs/httpmatches.js | ||
COPY ${NGINX_CONF_DIR}/nginx.conf /etc/nginx/nginx.conf | ||
COPY ${NGINX_CONF_DIR}/grpc-error-locations.conf /etc/nginx/grpc-error-locations.conf | ||
COPY ${NGINX_CONF_DIR}/grpc-error-pages.conf /etc/nginx/grpc-error-pages.conf | ||
|
||
# Set executable permissions | ||
RUN chmod +x /agent/entrypoint.sh && chown 101:1001 /agent/entrypoint.sh | ||
|
||
# Switch to non-root user | ||
USER 101:1001 | ||
|
||
ENTRYPOINT ["/agent/entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[agent] | ||
name=agent repo | ||
baseurl=https://packages.nginx.org/nginx-agent/centos/9/$basearch/ | ||
gpgcheck=1 | ||
enabled=1 | ||
module_hotfixes=true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[nginx] | ||
name=nginx repo | ||
baseurl=https://packages.nginx.org/nginx/mainline/centos/9/$basearch/ | ||
gpgcheck=1 | ||
enabled=1 | ||
module_hotfixes=true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.