1
1
# syntax=docker/dockerfile:1.16
2
- # TODO(sberman): the commented out lines are for when we use the published agent release
3
- # FROM scratch AS nginx-files
2
+ FROM scratch AS nginx-files
4
3
5
- # # the following links can be replaced with local files if needed, i.e. ADD --chown=101:1001 <local_file> <container_file>
6
- # ADD --link --chown=101:1001 https://cs.nginx.com/static/keys/nginx_signing.rsa.pub nginx_signing.rsa.pub
7
-
8
- FROM golang:alpine AS builder
9
-
10
- WORKDIR /tmp
11
-
12
- RUN apk add --no-cache git make \
13
- && git clone https://github.com/nginx/agent.git \
14
- && cd agent \
15
- && git checkout 0de3ba3451d8b05cced5eedb744a82db90db7e53 \
16
- && make build
4
+ # the following links can be replaced with local files if needed, i.e. ADD --chown=101:1001 <local_file> <container_file>
5
+ ADD --link --chown=101:1001 https://cs.nginx.com/static/keys/nginx_signing.rsa.pub nginx_signing.rsa.pub
17
6
18
7
FROM nginx:1.28.0-alpine-otel
19
8
9
+ # renovate: datasource=github-tags depName=nginx/agent extractVersion=^v?(?<version>.*)$
10
+ ARG NGINX_AGENT_VERSION=3.0.0
20
11
ARG NJS_DIR
21
12
ARG NGINX_CONF_DIR
22
13
ARG BUILD_AGENT
23
14
24
- # RUN --mount=type=bind,from=nginx-files,src=nginx_signing.rsa.pub,target=/etc/apk/keys/nginx_signing.rsa.pub \
25
- # printf "%s\n" "http ://packages.nginx.org/nginx-agent/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
26
- # && apk add --no-cache nginx-agent
15
+ RUN --mount=type=bind,from=nginx-files,src=nginx_signing.rsa.pub,target=/etc/apk/keys/nginx_signing.rsa.pub \
16
+ printf "%s\n" "https ://packages.nginx.org/nginx-agent/alpine/v$(egrep -o '^[0-9]+\.[0-9]+' /etc/alpine-release)/main" >> /etc/apk/repositories \
17
+ && apk add --no-cache nginx-agent=${NGINX_AGENT_VERSION}
27
18
28
19
RUN apk add --no-cache libcap bash \
29
20
&& mkdir -p /usr/lib/nginx/modules \
@@ -33,9 +24,10 @@ RUN apk add --no-cache libcap bash \
33
24
&& setcap -v 'cap_net_bind_service=+ep' /usr/sbin/nginx-debug \
34
25
# Update packages for CVE-2025-32414 and CVE-2025-32415
35
26
&& apk --no-cache upgrade libxml2 \
36
- && apk del libcap
37
-
38
- COPY --from=builder /tmp/agent/build/nginx-agent /usr/bin/nginx-agent
27
+ && apk del libcap \
28
+ # forward request and error logs to docker log collector
29
+ && ln -sf /dev/stdout /var/log/nginx/access.log \
30
+ && ln -sf /dev/stderr /var/log/nginx/error.log
39
31
40
32
COPY build/entrypoint.sh /agent/entrypoint.sh
41
33
COPY ${NJS_DIR}/httpmatches.js /usr/lib/nginx/modules/njs/httpmatches.js
0 commit comments