From 000edcd8aa0be0d84bcaf8c309bf4c36fd60dd5c Mon Sep 17 00:00:00 2001 From: Oliver O'Mahony Date: Mon, 1 Jul 2024 16:43:28 +0100 Subject: [PATCH 1/3] updated the official docker images to accept build parameters --- Makefile | 10 ++++++++++ README.md | 11 +++++++++-- .../alpine/Dockerfile.mainline | 4 ++-- .../alpine/Dockerfile.stable | 4 ++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index b086035a0..2541019b7 100644 --- a/Makefile +++ b/Makefile @@ -307,8 +307,18 @@ official-oss-image: ## Build official NGINX OSS with NGINX Agent container image @echo Building image nginx-oss-with-nginx-agent with $(CONTAINER_CLITOOL); \ cd scripts/docker/official/nginx-oss-with-nginx-agent/alpine/ \ && $(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build -t nginx-oss-with-nginx-agent . \ + --build-arg NGINX_AGENT_VERSION=$(shell echo ${VERSION} | tr -d 'v') \ --no-cache -f ./Dockerfile.mainline +official-oss-stable-image: ## Build official NGINX OSS with NGINX Agent container stable image + @echo Building image nginx-oss-with-nginx-agent with $(CONTAINER_CLITOOL); \ + cd scripts/docker/official/nginx-oss-with-nginx-agent/alpine/ \ + && $(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build -t nginx-oss-with-nginx-agent . \ + --build-arg NGINX_AGENT_VERSION=$(shell echo ${VERSION} | tr -d 'v') \ + --no-cache -f ./Dockerfile.stable + +official-oss-mainline-image: official-oss-image ## Build official NGINX OSS with NGINX Agent container mainline image + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Grafana Example Dashboard Targets # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # diff --git a/README.md b/README.md index bcd29e44e..680e5c765 100644 --- a/README.md +++ b/README.md @@ -163,11 +163,18 @@ If you need to make changes to the default configuration you can update the file For more detail on logrotate configuration see [Logrotate Configuration Options](https://linux.die.net/man/8/logrotate) ## Building Docker Image -To build an image that contains the latest NGINX Agent and the latest mainline version of NGINX OSS run the following command: -``` +To build an image that contains the latest NGINX Agent, the latest mainline version of NGINX OSS on latest Alpine run the following command: + +```make make official-oss-image ``` +To build an image that contains the latest NGINX Agent, the latest stable version of NGINX OSS on latest Alpine run the following command: + +```make +make official-oss-stable-image +``` + For more information on how to run NGINX Agent containers and how build an image that uses NGINX Plus instead of NGINX OSS see [Docker Images](https://docs.nginx.com/nginx-agent/installation-upgrade/container-environments/docker-images/) # Getting Started with NGINX Agent diff --git a/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.mainline b/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.mainline index a39d3c216..e4e65ff18 100644 --- a/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.mainline +++ b/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.mainline @@ -1,9 +1,9 @@ -ARG NGINX_VERSION=1.25.1-alpine +ARG NGINX_VERSION=mainline-alpine-slim FROM nginx:${NGINX_VERSION} LABEL maintainer="NGINX Docker Maintainers " -ARG NGINX_AGENT_VERSION=2.27.0 +ARG NGINX_AGENT_VERSION # Unlink symbolic links for access and error logs as the NGINX Agent # requires both files to be able to monitor NGINX and provide metrics. diff --git a/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.stable b/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.stable index 67ba94280..1cc6b3107 100644 --- a/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.stable +++ b/scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.stable @@ -1,9 +1,9 @@ -ARG NGINX_VERSION=1.24.0-alpine +ARG NGINX_VERSION=stable-alpine-slim FROM nginx:${NGINX_VERSION} LABEL maintainer="NGINX Docker Maintainers " -ARG NGINX_AGENT_VERSION=2.27.0 +ARG NGINX_AGENT_VERSION # Unlink symbolic links for access and error logs as the NGINX Agent # requires both files to be able to monitor NGINX and provide metrics. From b2c21a4f161e88b4fb895bedcc0c496aece4ab57 Mon Sep 17 00:00:00 2001 From: Oliver O'Mahony Date: Tue, 2 Jul 2024 13:29:16 +0100 Subject: [PATCH 2/3] override for VERSION --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2541019b7..c781691ea 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,11 @@ include Makefile.tools # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Variable Definitions # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -VERSION = $(shell git describe --match "v[0-9]*" --abbrev=0 --tags) ifeq ($(VERSION),) - VERSION = $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r) + VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags) +endif +ifeq ($(VERSION),) + VERSION ?= $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r) endif COMMIT = $(shell git rev-parse --short HEAD) DATE = $(shell date +%F_%H-%M-%S) From b61f49cca11f2f2e08121568e59441cd468e6d12 Mon Sep 17 00:00:00 2001 From: Oliver O'Mahony Date: Tue, 2 Jul 2024 13:33:59 +0100 Subject: [PATCH 3/3] unncessary if --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c781691ea..4904b0d0c 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,7 @@ include Makefile.tools # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Variable Definitions # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -ifeq ($(VERSION),) - VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags) -endif +VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags) ifeq ($(VERSION),) VERSION ?= $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r) endif