Skip to content
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

Refactor Build container images page #827

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/docker/nginx-plus/debian/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ RUN --mount=type=secret,id=nginx-crt,dst=/nginx-repo.crt \
ca-certificates \
gnupg \
lsb-release \
procps \
&& \
NGINX_GPGKEY=573BFD6B3D8FBC641079A6ABABF5BD827BD9BF62; \
found=''; \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ If you want to use NGINX Agent with NGINX Plus, you need to purchase an NGINX Pl

See the requirements and supported operating systems in the [NGINX Agent Technical Specifications]({{< relref "technical-specifications.md" >}}) topic.

## Deploy NGINX and NGINX Plus on Docker

Docker images are available in the [Deploying NGINX and NGINX Plus on Docker](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-docker/) NGINX documentation.

The document provides instructions on how to build images with NGINX Agent and NGINX packaged together. It includes steps for downloading the necessary Docker images, configuring your Docker environment, and deploying NGINX and NGINX Plus containers.

## Set up your environment

Expand Down Expand Up @@ -199,6 +204,20 @@ docker run --name nginx-agent -d \
nginx-agent
```

To ensure that the REST Interface is correctly configured, you can use the `curl` command targeting the following endpoint from your terminal:

```shell
curl 0.0.0.0:8038/nginx/
```

If the REST Interface is configured correctly, then you should see a JSON object ouputted to the terminal containing metadata such as NGINX version, path to the NGINX conf, and runtime modules.

**Sample Output:**

```code
[{"nginx_id":"b636d4376dea15405589692d3c5d3869ff3a9b26b0e7bb4bb1aa7e658ace1437","version":"1.27.1","conf_path":"/etc/nginx/nginx.conf","process_id":"7","process_path":"/usr/sbin/nginx","start_time":1725878806000,"built_from_source":false,"loadable_modules":null,"runtime_modules":["http_addition_module","http_auth_request_module","http_dav_module","http_flv_module","http_gunzip_module","http_gzip_static_module","http_mp4_module","http_random_index_module","http_realip_module","http_secure_link_module","http_slice_module","http_ssl_module","http_stub_status_module","http_sub_module","http_v2_module","http_v3_module","mail_ssl_module","stream_realip_module","stream_ssl_module","stream_ssl_preread_module"],"plus":{"enabled":false,"release":""},"ssl":{"ssl_type":0,"details":["OpenSSL","3.3.0","9 Apr 2024 (running with OpenSSL 3.3.1 4 Jun 2024)"]},"status_url":"","configure_args":["","prefix=/etc/nginx","sbin-path=/usr/sbin/nginx","modules-path=/usr/lib/nginx/modules","conf-path=/etc/nginx/nginx.conf","error-log-path=/var/log/nginx/error.log","http-log-path=/var/log/nginx/access.log","pid-path=/var/run/nginx.pid","lock-path=/var/run/nginx.lock","http-client-body-temp-path=/var/cache/nginx/client_temp","http-proxy-temp-path=/var/cache/nginx/proxy_temp","http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp","http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp","http-scgi-temp-path=/var/cache/nginx/scgi_temp","with-perl_modules_path=/usr/lib/perl5/vendor_perl","user=nginx","group=nginx","with-compat","with-file-aio","with-threads","with-http_addition_module","with-http_auth_request_module","with-http_dav_module","with-http_flv_module","with-http_gunzip_module","with-http_gzip_static_module","with-http_mp4_module","with-http_random_index_module","with-http_realip_module","with-http_secure_link_module","with-http_slice_module","with-http_ssl_module","with-http_stub_status_module","with-http_sub_module","with-http_v2_module","with-http_v3_module","with-mail","with-mail_ssl_module","with-stream","with-stream_realip_module","with-stream_ssl_module","with-stream_ssl_preread_module","with-cc-opt='-Os -fstack-clash-protection -Wformat -Werror=format-security -g'","with-ld-opt=-Wl,--as-needed,-O1,--sort-common"],"error_log_paths":null}]
```

<hr>

## Build the NGINX Agent images for specific OS targets
Expand All @@ -207,17 +226,18 @@ docker run --name nginx-agent -d \

The NGINX Agent GitHub repo has a set of Make commands that you can use to build a container image for an specific operating system and version:

- `make official-oss-image` builds an image containing NGINX Agent and NGINX open source.
- `make official-plus-image` builds an image containing NGINX Agent and NGINX Plus.
- `make oss-image` builds an image containing NGINX Agent and NGINX open source.
- `make image` builds an image containing NGINX Agent and NGINX Plus.

You can pass the following arguments when running the **make** command to build an NGINX Agent container image.

{{<bootstrap-table "table table-striped table-border">}}
| Argument | Definition |
| ---------------- | -------------------------|
| PACKAGE_NAME | **Required.** The full path to the downloaded [agent binary package](#agent-binary). <br>Must precede the **make** command. |
| OS_RELEASE | The Linux distribution to use as the base image. <br>Can also be set in the repo Makefile.|
| OS_VERSION | The version of the Linux distribution to use as the base image. <br>Can also be set in the repo Makefile.|
| AGENT_VERSION | The versions of NGINX agent that you want installed on the image.|

{{</bootstrap-table>}}

Refer to the [Supported distributions]({{< relref "/technical-specifications.md#supported-distributions" >}}) table to find out which base images you can use.
Expand All @@ -230,75 +250,18 @@ Keep the following information in mind when using the NGINX Agent [Dockerfiles](

### Build NGINX open source images

Run the following **make** command to build the default image, which uses Alpine 3.19 as the base image.

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] make official-oss-image
```

### Example build commands by distribution

{{<tabs name="build-oss-image">}}

{{%tab name="alma linux"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=almalinux make oss-image
```

{{% /tab %}}

{{%tab name="alpine linux"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=alpine make oss-image
```

{{% /tab %}}

{{%tab name="amazon linux"%}}
Run the following `make` command to build the default image, which uses Alpine as the base image:

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=amazonlinux make oss-image
IMAGE_BUILD_TARGET=install-agent-repo make oss-image
```

{{% /tab %}}

{{%tab name="debian"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=debian make oss-image
```

{{% /tab %}}

{{%tab name="oracle linux"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=oraclelinux make oss-image
```

{{% /tab %}}

{{%tab name="rocky linux"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=rockylinux make oss-image
```

{{% /tab %}}

{{%tab name="ubuntu"%}}

The command below creates a base image using the most recent LTS version of Ubuntu as the base image:
To build an image with Debian and an older version of NGINX Agent you can run the following command:

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] make oss-image OS_RELEASE=ubuntu
IMAGE_BUILD_TARGET=install-agent-repo NGINX_AGENT_VERSION=2.37.0~bullseye OS_RELEASE=debian OS_VERSION=bullseye-slim make oss-image
```

{{% /tab %}}

{{% /tabs %}}

### Build NGINX Plus images

Expand All @@ -307,75 +270,13 @@ PACKAGE_NAME=[PATH-TO-PACKAGE] make oss-image OS_RELEASE=ubuntu
Run the following `make` command to build the default image, which uses Ubuntu 24.04 (Noble) as the base image.

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] make official-plus-image
```

### Example NGINX Plus build commands by distribution

{{<tabs name="build-image">}}

{{%tab name="alpine linux"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=alpine make official-plus-image
```

{{% /tab %}}

{{%tab name="amazon linux"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=amazonlinux make official-plus-image
```

{{% /tab %}}

{{%tab name="centos"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=centos OS_VERSION=7 make official-plus-image
```

{{% /tab %}}

{{%tab name="debian"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=debian OS_VERSION=bullseye-slim make official-plus-image
IMAGE_BUILD_TARGET=install-agent-repo make image
```

{{% /tab %}}

{{%tab name="oracle linux"%}}
To build an image with Debian and an older version of NGINX Agent you can run the following command:

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=oraclelinux make official-plus-image
IMAGE_BUILD_TARGET=install-agent-repo NGINX_AGENT_VERSION=2.37.0~bullseye OS_RELEASE=debian OS_VERSION=bullseye-slim make image
```

{{% /tab %}}

{{%tab name="rhel"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=redhatenterprise make official-plus-image
```

{{% /tab %}}

{{%tab name="suse"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=suse OS_VERSION=sle15 make official-plus-image
```

{{% /tab %}}

{{%tab name="ubuntu"%}}

```shell
PACKAGE_NAME=[PATH-TO-PACKAGE] OS_RELEASE=ubuntu make official-plus-image
```

{{% /tab %}}

{{% /tabs %}}
Loading