Skip to content

Commit dbccba6

Browse files
committed
Test agent fix
1 parent 06c40f2 commit dbccba6

File tree

4 files changed

+54
-11
lines changed

4 files changed

+54
-11
lines changed

build/Dockerfile.nginx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@ RUN apk update && apk add --no-cache 'pcre2>=10.46-r0' 'libxml2>=2.13.9-r0'
1212

1313
# renovate: datasource=github-tags depName=nginx/agent
1414
ARG NGINX_AGENT_VERSION=v3.3.2
15+
ARG NGINX_AGENT_BRANCH=fix-atomic-writes-issue
1516
ARG NJS_DIR
1617
ARG NGINX_CONF_DIR
1718
ARG BUILD_AGENT
1819

19-
RUN --mount=type=bind,from=nginx-files,src=nginx_signing.rsa.pub,target=/etc/apk/keys/nginx_signing.rsa.pub \
20-
printf "%s\n" "https://packages.nginx.org/nginx-agent/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
21-
&& apk add --no-cache nginx-agent=${NGINX_AGENT_VERSION#v}
20+
# Build nginx-agent from source using the fix branch
21+
RUN apk add --no-cache git go make \
22+
&& git clone --branch ${NGINX_AGENT_BRANCH} --depth 1 https://github.com/nginx/agent.git /tmp/agent \
23+
&& cd /tmp/agent \
24+
&& make build \
25+
&& cp /tmp/agent/build/nginx-agent /usr/bin/nginx-agent \
26+
&& mkdir -p /etc/nginx-agent \
27+
&& cp /tmp/agent/nginx-agent.conf /etc/nginx-agent/ \
28+
&& cd / \
29+
&& rm -rf /tmp/agent \
30+
&& apk del git go make
2231

2332
RUN apk add --no-cache bash \
2433
&& mkdir -p /usr/lib/nginx/modules \

build/Dockerfile.nginxplus

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FROM alpine:3.22
99
ARG NGINX_PLUS_VERSION=R35
1010
# renovate: datasource=github-tags depName=nginx/agent
1111
ARG NGINX_AGENT_VERSION=v3.3.2
12+
ARG NGINX_AGENT_BRANCH=fix-atomic-writes-issue
1213
ARG NJS_DIR
1314
ARG NGINX_CONF_DIR
1415
ARG BUILD_AGENT
@@ -19,8 +20,19 @@ RUN --mount=type=secret,id=nginx-repo.crt,dst=/etc/apk/cert.pem,mode=0644 \
1920
addgroup -g 1001 -S nginx \
2021
&& adduser -S -D -H -u 101 -h /var/cache/nginx -s /sbin/nologin -G nginx -g nginx nginx \
2122
&& printf "%s\n" "https://pkgs.nginx.com/plus/${NGINX_PLUS_VERSION}/alpine/v$(grep -E -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
22-
&& printf "%s\n" "https://pkgs.nginx.com/nginx-agent/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
23-
&& apk add --no-cache nginx-plus nginx-plus-module-njs nginx-plus-module-otel nginx-agent=${NGINX_AGENT_VERSION#v}
23+
&& apk add --no-cache nginx-plus nginx-plus-module-njs nginx-plus-module-otel
24+
25+
# Build nginx-agent from source using the fix branch
26+
RUN apk add --no-cache git go make \
27+
&& git clone --branch ${NGINX_AGENT_BRANCH} --depth 1 https://github.com/nginx/agent.git /tmp/agent \
28+
&& cd /tmp/agent \
29+
&& make build \
30+
&& cp /tmp/agent/build/nginx-agent /usr/bin/nginx-agent \
31+
&& mkdir -p /etc/nginx-agent \
32+
&& cp /tmp/agent/nginx-agent.conf /etc/nginx-agent/ \
33+
&& cd / \
34+
&& rm -rf /tmp/agent \
35+
&& apk del git go make
2436

2537
RUN apk add --no-cache bash \
2638
&& mkdir -p /usr/lib/nginx/modules \

build/ubi/Dockerfile.nginx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ FROM redhat/ubi9-minimal:9.6 AS ubi-nginx
1212

1313
# renovate: datasource=github-tags depName=nginx/agent
1414
ARG NGINX_AGENT_VERSION=v3.3.2
15+
ARG NGINX_AGENT_BRANCH=fix-atomic-writes-issue
1516
ARG NJS_DIR
1617
ARG NGINX_CONF_DIR
1718
ARG BUILD_AGENT
@@ -30,7 +31,6 @@ COPY --link --chown=101:1001 LICENSE /licenses/
3031
# Install NGINX with packages
3132
RUN --mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
3233
--mount=type=bind,from=nginx-files,src=nginx.repo,target=/etc/yum.repos.d/nginx.repo \
33-
--mount=type=bind,from=nginx-files,src=agent.repo,target=/etc/yum.repos.d/agent.repo \
3434
--mount=type=bind,from=ubi9-packages,src=/,target=/ubi-bin/ \
3535
# Import NGINX signing key
3636
rpm --import /tmp/nginx_signing.key \
@@ -41,12 +41,23 @@ RUN --mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_s
4141
&& useradd -r -u 101 -g nginx -s /sbin/nologin -d /var/cache/nginx nginx \
4242
# Install NGINX and modules including OTEL
4343
&& microdnf --nodocs install -y nginx nginx-module-njs nginx-module-otel \
44-
# Install nginx-agent
45-
&& microdnf --nodocs install -y nginx-agent-${NGINX_AGENT_VERSION#v}* \
4644
# Clean up (only remove what we can)
4745
&& microdnf clean all \
4846
&& rm -rf /var/cache/yum
4947

48+
# Build nginx-agent from source using the fix branch
49+
RUN microdnf --nodocs install -y git golang make \
50+
&& git clone --branch ${NGINX_AGENT_BRANCH} --depth 1 https://github.com/nginx/agent.git /tmp/agent \
51+
&& cd /tmp/agent \
52+
&& make build \
53+
&& cp /tmp/agent/build/nginx-agent /usr/bin/nginx-agent \
54+
&& mkdir -p /etc/nginx-agent \
55+
&& cp /tmp/agent/nginx-agent.conf /etc/nginx-agent/ \
56+
&& cd / \
57+
&& rm -rf /tmp/agent \
58+
&& microdnf remove -y git golang make \
59+
&& microdnf clean all
60+
5061
# Configure directories and logging
5162
RUN mkdir -p /var/run/nginx /usr/lib64/nginx/modules \
5263
# Forward request and error logs to docker log collector

build/ubi/Dockerfile.nginxplus

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ARG NGINX_PLUS_VERSION=R35
1414

1515
# renovate: datasource=github-tags depName=nginx/agent
1616
ARG NGINX_AGENT_VERSION=v3.3.2
17+
ARG NGINX_AGENT_BRANCH=fix-atomic-writes-issue
1718
ARG NJS_DIR
1819
ARG NGINX_CONF_DIR
1920
ARG BUILD_AGENT
@@ -31,7 +32,6 @@ COPY --link --chown=101:1001 LICENSE /licenses/
3132

3233
# Install NGINX Plus and modules
3334
RUN --mount=type=bind,from=nginx-files,src=nginx-plus.repo,target=/etc/yum.repos.d/nginx-plus.repo \
34-
--mount=type=bind,from=nginx-files,src=agent.repo,target=/etc/yum.repos.d/agent.repo \
3535
--mount=type=bind,from=nginx-files,src=nginx_signing.key,target=/tmp/nginx_signing.key \
3636
--mount=type=bind,from=ubi9-packages,src=/,target=/ubi-bin/ \
3737
--mount=type=secret,id=nginx-repo.crt,dst=/etc/ssl/nginx/nginx-repo.crt,mode=0644 \
@@ -47,13 +47,24 @@ RUN --mount=type=bind,from=nginx-files,src=nginx-plus.repo,target=/etc/yum.repos
4747
# Install NGINX Plus and modules (njs, otel)
4848
&& microdnf --nodocs install -y nginx-plus-${NGINX_PLUS_VERSION,,} \
4949
&& microdnf --nodocs install -y nginx-plus-module-njs-${NGINX_PLUS_VERSION,,} nginx-plus-module-otel-${NGINX_PLUS_VERSION,,} \
50-
# Install nginx-agent
51-
&& microdnf --nodocs install -y nginx-agent-${NGINX_AGENT_VERSION#v}* \
5250
# Clean up
5351
&& microdnf remove -y shadow-utils \
5452
&& microdnf clean all \
5553
&& rm -rf /var/cache/yum
5654

55+
# Build nginx-agent from source using the fix branch
56+
RUN microdnf --nodocs install -y git golang make \
57+
&& git clone --branch ${NGINX_AGENT_BRANCH} --depth 1 https://github.com/nginx/agent.git /tmp/agent \
58+
&& cd /tmp/agent \
59+
&& make build \
60+
&& cp /tmp/agent/build/nginx-agent /usr/bin/nginx-agent \
61+
&& mkdir -p /etc/nginx-agent \
62+
&& cp /tmp/agent/nginx-agent.conf /etc/nginx-agent/ \
63+
&& cd / \
64+
&& rm -rf /tmp/agent \
65+
&& microdnf remove -y git golang make \
66+
&& microdnf clean all
67+
5768
# Configure directories and logging
5869
RUN mkdir -p /var/run/nginx /usr/lib64/nginx/modules \
5970
# Forward request and error logs to docker log collector

0 commit comments

Comments
 (0)