Skip to content

Commit e2943d9

Browse files
committed
feat: update nginx plus image builds
This change migrates to using the official NGINX Plus Docker images as base images. Signed-off-by: Elijah Zupancic <[email protected]>
1 parent 3a33d55 commit e2943d9

File tree

5 files changed

+29
-176
lines changed

5 files changed

+29
-176
lines changed

Dockerfile.buildkit.plus

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
FROM debian:bookworm-slim@sha256:b1211f6d19afd012477bd34fdcabb6b663d680e0f4b0537da6e6b0fd057a3ec3
1+
FROM private-registry.nginx.com/nginx-plus/base:r35-debian-bookworm
22

33
# Create RELEASE argument
44
ARG RELEASE=bookworm
55

6-
# NJS env vars
7-
ENV NGINX_VERSION=34
8-
ENV NGINX_PKG_RELEASE=1~${RELEASE}
9-
ENV NJS_VERSION=0.9.0
6+
# OSS equivalent version
7+
ENV NGINX_VERSION=1.29.0
8+
# Plus version
9+
ENV NGINX_PLUS_VERSION=35
10+
# PKG release version for XSLT module
11+
ENV XSLT_PKG_RELEASE=1~${RELEASE}
12+
# NJS version
13+
ENV NJS_VERSION=0.9.1
14+
# PKG release version for njs module
1015
ENV NJS_PKG_RELEASE=1~${RELEASE}
1116

1217
# Proxy cache env vars
@@ -36,9 +41,6 @@ ENV PREFIX_LEADING_DIRECTORY_PATH=""
3641
RUN --mount=type=secret,id=nginx-crt,dst=nginx-repo.crt \
3742
--mount=type=secret,id=nginx-key,dst=nginx-repo.key \
3843
set -x \
39-
# Create nginx user/group first, to be consistent throughout Docker variants
40-
&& groupadd --system --gid 101 nginx \
41-
&& useradd --system --gid nginx --no-create-home --home /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
4244
&& apt-get update \
4345
&& apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg1 lsb-release \
4446
&& \
@@ -61,9 +63,8 @@ RUN --mount=type=secret,id=nginx-crt,dst=nginx-repo.crt \
6163
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
6264
# Install the latest release of NGINX Plus and/or NGINX Plus modules (written and maintained by F5)
6365
&& nginxPackages=" \
64-
nginx-plus=${NGINX_VERSION}-${NGINX_PKG_RELEASE} \
65-
nginx-plus-module-njs=${NGINX_VERSION}+${NJS_VERSION}-${NJS_PKG_RELEASE} \
66-
nginx-plus-module-xslt=${NGINX_VERSION}-${NGINX_PKG_RELEASE} \
66+
nginx-plus-module-njs=${NGINX_PLUS_VERSION}+${NJS_VERSION}-${NJS_PKG_RELEASE} \
67+
nginx-plus-module-xslt=${NGINX_PLUS_VERSION}-${XSLT_PKG_RELEASE} \
6768
" \
6869
&& echo "Acquire::https::pkgs.nginx.com::Verify-Peer \"true\";" > /etc/apt/apt.conf.d/90nginx \
6970
&& echo "Acquire::https::pkgs.nginx.com::Verify-Host \"true\";" >> /etc/apt/apt.conf.d/90nginx \
@@ -77,28 +78,16 @@ RUN --mount=type=secret,id=nginx-crt,dst=nginx-repo.crt \
7778
&& apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages curl gettext-base \
7879
&& apt-get remove --purge -y lsb-release \
7980
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx-plus.list \
80-
&& rm -rf /etc/apt/apt.conf.d/90nginx /etc/ssl/nginx \
81-
# Forward request logs to Docker log collector
82-
&& ln -sf /dev/stdout /var/log/nginx/access.log \
83-
&& ln -sf /dev/stderr /var/log/nginx/error.log
84-
85-
EXPOSE 80
86-
87-
STOPSIGNAL SIGTERM
88-
89-
CMD ["nginx", "-g", "daemon off;"]
81+
&& rm -rf /etc/apt/apt.conf.d/90nginx /etc/ssl/nginx
9082

9183
# Copy files from the OSS NGINX Docker container such that the container
9284
# startup is the same.
9385
COPY plus/etc/nginx /etc/nginx
9486
COPY common/etc /etc
9587
COPY common/docker-entrypoint.sh /docker-entrypoint.sh
9688
COPY common/docker-entrypoint.d /docker-entrypoint.d/
97-
COPY plus/docker-entrypoint.d /docker-entrypoint.d/
9889

9990
RUN set -x \
10091
&& mkdir -p /var/cache/nginx/s3_proxy \
10192
&& chown nginx:nginx /var/cache/nginx/s3_proxy \
10293
&& chmod -R -v +x /docker-entrypoint.sh /docker-entrypoint.d/*.sh;
103-
104-
ENTRYPOINT ["/docker-entrypoint.sh"]

Dockerfile.plus

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
FROM debian:bookworm-slim@sha256:b1211f6d19afd012477bd34fdcabb6b663d680e0f4b0537da6e6b0fd057a3ec3
1+
FROM private-registry.nginx.com/nginx-plus/base:r35-debian-bookworm
22

33
# Create RELEASE argument
44
ARG RELEASE=bookworm
55

6-
# NJS env vars
7-
ENV NGINX_VERSION=34
8-
ENV NGINX_PKG_RELEASE=1~${RELEASE}
9-
ENV NJS_VERSION=0.9.0
6+
# OSS equivalent version
7+
ENV NGINX_VERSION=1.29.0
8+
# Plus version
9+
ENV NGINX_PLUS_VERSION=35
10+
# PKG release version for XSLT module
11+
ENV XSLT_PKG_RELEASE=1~${RELEASE}
12+
# NJS version
13+
ENV NJS_VERSION=0.9.1
14+
# PKG release version for njs module
1015
ENV NJS_PKG_RELEASE=1~${RELEASE}
1116

1217
# Proxy cache env vars
@@ -37,8 +42,6 @@ COPY plus/etc/ssl /etc/ssl
3742

3843
RUN set -x \
3944
# Create nginx user/group first, to be consistent throughout Docker variants
40-
&& groupadd --system --gid 101 nginx \
41-
&& useradd --system --gid nginx --no-create-home --home /nonexistent --comment "nginx user" --shell /bin/false --uid 101 nginx \
4245
&& apt-get update \
4346
&& apt-get install --no-install-recommends --no-install-suggests -y ca-certificates gnupg1 lsb-release \
4447
&& \
@@ -61,9 +64,8 @@ RUN set -x \
6164
apt-get remove --purge --auto-remove -y gnupg1 && rm -rf /var/lib/apt/lists/* \
6265
# Install the latest release of NGINX Plus and/or NGINX Plus modules (written and maintained by F5)
6366
&& nginxPackages=" \
64-
nginx-plus=${NGINX_VERSION}-${NGINX_PKG_RELEASE} \
65-
nginx-plus-module-njs=${NGINX_VERSION}+${NJS_VERSION}-${NJS_PKG_RELEASE} \
66-
nginx-plus-module-xslt=${NGINX_VERSION}-${NGINX_PKG_RELEASE} \
67+
nginx-plus-module-njs=${NGINX_PLUS_VERSION}+${NJS_VERSION}-${NJS_PKG_RELEASE} \
68+
nginx-plus-module-xslt=${NGINX_PLUS_VERSION}-${XSLT_PKG_RELEASE} \
6769
" \
6870
&& echo "Acquire::https::pkgs.nginx.com::Verify-Peer \"true\";" > /etc/apt/apt.conf.d/90nginx \
6971
&& echo "Acquire::https::pkgs.nginx.com::Verify-Host \"true\";" >> /etc/apt/apt.conf.d/90nginx \
@@ -74,28 +76,15 @@ RUN set -x \
7476
&& apt-get install --no-install-recommends --no-install-suggests -y $nginxPackages curl gettext-base \
7577
&& apt-get remove --purge -y lsb-release \
7678
&& apt-get remove --purge --auto-remove -y && rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/nginx-plus.list \
77-
&& rm -rf /etc/apt/apt.conf.d/90nginx /etc/ssl/nginx \
78-
# Forward request logs to Docker log collector
79-
&& ln -sf /dev/stdout /var/log/nginx/access.log \
80-
&& ln -sf /dev/stderr /var/log/nginx/error.log
81-
82-
EXPOSE 80
83-
84-
STOPSIGNAL SIGTERM
85-
86-
CMD ["nginx", "-g", "daemon off;"]
79+
&& rm -rf /etc/apt/apt.conf.d/90nginx /etc/ssl/nginx
8780

8881
# Copy files from the OSS NGINX Docker container such that the container
8982
# startup is the same.
9083
COPY plus/etc/nginx /etc/nginx
9184
COPY common/etc /etc
9285
COPY common/docker-entrypoint.sh /docker-entrypoint.sh
93-
COPY common/docker-entrypoint.d /docker-entrypoint.d/
94-
COPY plus/docker-entrypoint.d /docker-entrypoint.d/
9586

9687
RUN set -x \
9788
&& mkdir -p /var/cache/nginx/s3_proxy \
9889
&& chown nginx:nginx /var/cache/nginx/s3_proxy \
9990
&& chmod -R -v +x /docker-entrypoint.sh /docker-entrypoint.d/*.sh;
100-
101-
ENTRYPOINT ["/docker-entrypoint.sh"]

docs/getting_started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,9 @@ It is worth noting that due to the way the startup scripts work, even the unpriv
269269

270270
### Building the NGINX Plus Container Image
271271

272-
In order to build the NGINX Plus container image, copy your NGINX Plus
273-
repository keys (`nginx-repo.crt` and `nginx-repo.key`) into the
274-
`plus/etc/ssl/nginx` directory before building.
272+
In order to build the NGINX Plus container image, you will need to do two things:
273+
1. Setup the offical NGINX Plus Docker image repository, as [per the documentation](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/#use-official-nginx-plus-docker-images).
274+
2. Copy your NGINX Plus repository keys (`nginx-repo.crt` and `nginx-repo.key`) into the `plus/etc/ssl/nginx` directory on the system doing the container build.
275275

276276
If you are using a version of Docker that supports Buildkit, then you can
277277
build the image as follows in order to prevent your private keys from

plus/docker-entrypoint.d/10-listen-on-ipv6-by-default.sh

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

plus/docker-entrypoint.d/20-envsubst-on-templates.sh

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

0 commit comments

Comments
 (0)