Skip to content

Commit 7b1c9cb

Browse files
oliveromahonyspencerugbo
authored andcommitted
More flexible container images for the official images (#729)
* updated the official docker images to accept build parameters and add override VERSION variable
1 parent 02f8a89 commit 7b1c9cb

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

Makefile

+12-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ include Makefile.tools
33
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
44
# Variable Definitions #
55
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
6-
VERSION = $(shell git describe --match "v[0-9]*" --abbrev=0 --tags)
6+
VERSION ?= $(shell git describe --match "v[0-9]*" --abbrev=0 --tags)
77
ifeq ($(VERSION),)
8-
VERSION = $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r)
8+
VERSION ?= $(shell curl https://api.github.com/repos/nginx/agent/releases/latest -s | jq .name -r)
99
endif
1010
COMMIT = $(shell git rev-parse --short HEAD)
1111
DATE = $(shell date +%F_%H-%M-%S)
@@ -307,8 +307,18 @@ official-oss-image: ## Build official NGINX OSS with NGINX Agent container image
307307
@echo Building image nginx-oss-with-nginx-agent with $(CONTAINER_CLITOOL); \
308308
cd scripts/docker/official/nginx-oss-with-nginx-agent/alpine/ \
309309
&& $(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build -t nginx-oss-with-nginx-agent . \
310+
--build-arg NGINX_AGENT_VERSION=$(shell echo ${VERSION} | tr -d 'v') \
310311
--no-cache -f ./Dockerfile.mainline
311312

313+
official-oss-stable-image: ## Build official NGINX OSS with NGINX Agent container stable image
314+
@echo Building image nginx-oss-with-nginx-agent with $(CONTAINER_CLITOOL); \
315+
cd scripts/docker/official/nginx-oss-with-nginx-agent/alpine/ \
316+
&& $(CONTAINER_BUILDENV) $(CONTAINER_CLITOOL) build -t nginx-oss-with-nginx-agent . \
317+
--build-arg NGINX_AGENT_VERSION=$(shell echo ${VERSION} | tr -d 'v') \
318+
--no-cache -f ./Dockerfile.stable
319+
320+
official-oss-mainline-image: official-oss-image ## Build official NGINX OSS with NGINX Agent container mainline image
321+
312322
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
313323
# Grafana Example Dashboard Targets #
314324
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

README.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,18 @@ If you need to make changes to the default configuration you can update the file
163163
For more detail on logrotate configuration see [Logrotate Configuration Options](https://linux.die.net/man/8/logrotate)
164164

165165
## Building Docker Image
166-
To build an image that contains the latest NGINX Agent and the latest mainline version of NGINX OSS run the following command:
167-
```
166+
To build an image that contains the latest NGINX Agent, the latest mainline version of NGINX OSS on latest Alpine run the following command:
167+
168+
```make
168169
make official-oss-image
169170
```
170171

172+
To build an image that contains the latest NGINX Agent, the latest stable version of NGINX OSS on latest Alpine run the following command:
173+
174+
```make
175+
make official-oss-stable-image
176+
```
177+
171178
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/)
172179

173180
# Getting Started with NGINX Agent

scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.mainline

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
ARG NGINX_VERSION=1.25.1-alpine
1+
ARG NGINX_VERSION=mainline-alpine-slim
22

33
FROM nginx:${NGINX_VERSION}
44
LABEL maintainer="NGINX Docker Maintainers <[email protected]>"
55

6-
ARG NGINX_AGENT_VERSION=2.27.0
6+
ARG NGINX_AGENT_VERSION
77

88
# Unlink symbolic links for access and error logs as the NGINX Agent
99
# requires both files to be able to monitor NGINX and provide metrics.

scripts/docker/official/nginx-oss-with-nginx-agent/alpine/Dockerfile.stable

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
ARG NGINX_VERSION=1.24.0-alpine
1+
ARG NGINX_VERSION=stable-alpine-slim
22

33
FROM nginx:${NGINX_VERSION}
44
LABEL maintainer="NGINX Docker Maintainers <[email protected]>"
55

6-
ARG NGINX_AGENT_VERSION=2.27.0
6+
ARG NGINX_AGENT_VERSION
77

88
# Unlink symbolic links for access and error logs as the NGINX Agent
99
# requires both files to be able to monitor NGINX and provide metrics.

0 commit comments

Comments
 (0)