Skip to content
This repository was archived by the owner on Jan 11, 2025. It is now read-only.

Commit e308f5b

Browse files
added more documentation about extended/minimal image
1 parent b2569c4 commit e308f5b

File tree

3 files changed

+76
-21
lines changed

3 files changed

+76
-21
lines changed

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@ build-debian:
1818
build-ubuntu:
1919
./bin/docker-build.sh ubuntu 1
2020

21+
build-all-minimal: build-alpine-minimal build-centos-minimal build-amazonlinux-minimal build-fedora-minimal build-debian-minimal build-ubuntu-minimal
22+
23+
build-alpine-minimal:
24+
./bin/docker-build.sh alpine 1 0
25+
26+
build-centos-minimal:
27+
./bin/docker-build.sh centos 1 0
28+
29+
build-amazonlinux-minimal:
30+
./bin/docker-build.sh amazonlinux 1 0
31+
32+
build-fedora-minimal:
33+
./bin/docker-build.sh fedora 1 0
34+
35+
build-debian-minimal:
36+
./bin/docker-build.sh debian 1 0
37+
38+
build-ubuntu-minimal:
39+
./bin/docker-build.sh ubuntu 1 0
40+
2141
push-all: push-alpine push-centos push-amazonlinux push-fedora push-debian push-ubuntu
2242

2343
push-alpine:

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ $ docker run -d -e NGINX_ENTRYPOINT_QUIET_LOGS=1 nginx
243243

244244
### Compiled Version Details
245245

246-
```bash
246+
```console
247247
configure arguments: --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-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --user=nginx --group=nginx --add-module=/lua-nginx-module-0.10.15 --add-module=/ngx_devel_kit-0.3.1 --with-compat --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_dav_module --with-http_flv_module --with-http_geoip_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-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fPIC' --with-ld-opt='-Wl,-rpath,/usr/local/lib -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -pie'
248248
```
249249

@@ -256,7 +256,7 @@ The following are the available build-time options. They can be set using the `-
256256
| DOCKER_IMAGE_TAG | `3.12.0` | The Docker image tag to build `FROM`. |
257257
| BUILD_DATE | | This label contains the Date/Time the image was built. |
258258
| VCS_REF | | Identifier for the version of the source code from which this image was built. |
259-
| EXTENDED_IMAGE | `1` | Flag to identify if extended image (which contains extra modules). |
259+
| EXTENDED_IMAGE | `1` | Flag to identify if extended image (which contains extra modules). See [Minimal Image](#minimal-image). |
260260
| VER_NGX_DEVEL_KIT | `0.3.1` | The version of [Nginx Development Kit](https://github.com/vision5/ngx_devel_kit) to use. |
261261
| VER_LUAJIT | `2.1-20201002` | The version of [LuaJIT](https://github.com/openresty/luajit2) to use. |
262262
| LUAJIT_LIB | `/usr/local/lib` | Tell nginx's build system where to find LuaJIT 2.0 |
@@ -319,8 +319,8 @@ These built-from-source flavors include the following modules by default, but on
319319

320320
## Run Container
321321

322-
```bash
323-
docker run -it --rm -p 80:80 \
322+
```console
323+
$ docker run -it --rm -p 80:80 \
324324
--health-cmd='curl --fail http://example.com || exit 1' \
325325
--health-interval=30s \
326326
--health-timeout=3s \
@@ -330,19 +330,43 @@ docker run -it --rm -p 80:80 \
330330
## Image Variants
331331

332332
### `fabiocicerchia/nginx-lua:<version>`
333-
The default Nginx + Lua image. Uses Alpine for base image.
333+
The default Nginx + Lua + extra lua modules image. Uses Alpine for base image.
334334

335335
### `fabiocicerchia/nginx-lua:<version>-<distro>`
336-
Provides Nginx + Lua. Uses Alpine, Amazon Linux, CentOS, Debian, Fedora, Ubuntu for base image.
336+
Provides Nginx + Lua + extra lua modules. Uses Alpine, Amazon Linux, CentOS, Debian, Fedora, Ubuntu for base image.
337337

338338
### `fabiocicerchia/nginx-lua:<version>-<distro><version>`
339-
Provides Nginx + Lua. Uses pinned version for Alpine, Amazon Linux, CentOS, Debian, Fedora, Ubuntu for base image.
339+
Provides Nginx + Lua + extra lua modules. Uses pinned version for Alpine, Amazon Linux, CentOS, Debian, Fedora, Ubuntu for base image.
340+
341+
### `fabiocicerchia/nginx-lua:<version>-minimal`
342+
Provides Nginx + Lua image. Uses Alpine for base image.
343+
**WARNING:** Not available as tag, need manual build, see [Minimal Image](#minimal-image)
344+
345+
### `fabiocicerchia/nginx-lua:<version>-<distro>-minimal`
346+
Provides Nginx + Lua. Uses Alpine, Amazon Linux, CentOS, Debian, Fedora, Ubuntu for base image.
347+
**WARNING:** Not available as tag, need manual build, see [Minimal Image](#minimal-image)
348+
349+
### `fabiocicerchia/nginx-lua:<version>-<distro><version>-minimal`
350+
Provides Nginx + Lua. Uses pinned version for Alpine, Amazon Linux, CentOS, Debian, Fedora, Ubuntu for base image.
351+
**WARNING:** Not available as tag, need manual build, see [Minimal Image](#minimal-image)
352+
353+
## Minimal Image
354+
355+
The extended image (default one) contains a set of extra packages for enhanced functionality.
356+
If you need a smaller version, like the official distros (containing only nginx and openresty's lua module),
357+
you could build specifying the build argument set to 0:
358+
359+
```console
360+
$ docker build \
361+
--build-arg EXTENDED=0 \
362+
-f $DOCKERFILE .
363+
```
340364

341365
## Image Labels
342366

343367
The image builds are labeled with various information. Here's an example of printing the labels using jq:
344368

345-
```bash
369+
```console
346370
$ docker pull fabiocicerchia/nginx-lua:1-alpine
347371
$ docker inspect fabiocicerchia/nginx-lua:1-alpine | jq '.[].Config.Labels'
348372
{

bin/docker-build.sh

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ function build() {
1515
VER_TAGS=$4
1616
OS_TAGS=$5
1717
DEFAULT=$6
18+
EXTENDED=$7
1819

1920
DOCKERFILE_PATH=nginx/$NGINX_VER/$OS/$OS_VER
2021
DOCKERFILE=$DOCKERFILE_PATH/Dockerfile
@@ -27,32 +28,38 @@ function build() {
2728
return
2829
fi
2930

31+
SUFFIX=""
32+
if [ $EXTENDED -eq 0 ]; then
33+
SUFFIX="-minimal"
34+
fi
35+
3036
TAGS=""
3137
if [ "$VER_TAGS$OS_TAGS$DEFAULT" == "111" ]; then
32-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR"
33-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MINOR"
34-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$PATCH"
35-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:latest"
38+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR$SUFFIX"
39+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MINOR$SUFFIX"
40+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$PATCH$SUFFIX"
41+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:latest$SUFFIX"
3642
fi
3743

3844
if [ "$VER_TAGS$OS_TAGS" == "11" ]; then
39-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$OS"
40-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR-$OS"
41-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR-$OS$OS_VER"
45+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$OS$SUFFIX"
46+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR-$OS$SUFFIX"
47+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR-$OS$OS_VER$SUFFIX"
4248
fi
4349

4450
if [ "$OS_TAGS" == "1" ]; then
45-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MINOR-$OS"
46-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$PATCH-$OS"
51+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MINOR-$OS$SUFFIX"
52+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$PATCH-$OS$SUFFIX"
4753
fi
4854

49-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$PATCH-$OS$OS_VER"
50-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MINOR-$OS$OS_VER"
51-
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR-$OS$OS_VER"
55+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$PATCH-$OS$OS_VER$SUFFIX"
56+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MINOR-$OS$OS_VER$SUFFIX"
57+
TAGS="$TAGS -t fabiocicerchia/nginx-lua:$MAJOR-$OS$OS_VER$SUFFIX"
5258

5359
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
5460
VCS_REF=$(git rev-parse --short HEAD)
5561
time docker build \
62+
--build-arg EXTENDED=$EXTENDED \
5663
--build-arg BUILD_DATE=$BUILD_DATE \
5764
--build-arg VCS_REF=$VCS_REF \
5865
$TAGS \
@@ -66,6 +73,10 @@ FORCE=0
6673
if [ "$2" == "1" ]; then
6774
FORCE=1
6875
fi
76+
EXTENDED=1
77+
if [ "$2" == "0" ]; then
78+
EXTENDED=0
79+
fi
6980
VERSIONS=()
7081
if [ "$OS" == "alpine" ]; then VERSIONS=("${ALPINE[@]}")
7182
elif [ "$OS" == "amazonlinux" ]; then VERSIONS=("${AMAZONLINUX[@]}")
@@ -95,7 +106,7 @@ for (( I=0; I<$NLEN; I++ )); do
95106
if [ "$((J+1))" == "$DLEN" ]; then
96107
OS_TAGS=1
97108
fi
98-
build $NGINX_VER $OS $OS_VER $VER_TAGS $OS_TAGS $DEFAULT
109+
build $NGINX_VER $OS $OS_VER $VER_TAGS $OS_TAGS $DEFAULT $EXTENDED
99110
done
100111

101112
done

0 commit comments

Comments
 (0)