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

Commit 6a91f71

Browse files
- reduced support only to latest version of alpine, amazonlinux, centos, debian, fedora, ubuntu
- refactoring dockerfile + added makefile - upgraded version on dependencies - linting
1 parent f3fa785 commit 6a91f71

37 files changed

+2688
-3510
lines changed

.github/workflows/auto_update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- uses: actions/checkout@v2
1515

1616
- name: Generate Supported Versions
17-
run: ./bin/auto_update.sh
17+
run: make auto-update-and-commit
1818

1919
docker_alpine:
2020
runs-on: ubuntu-latest

.hadolint.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
ignored:
2-
- DL3003 # Use WORKDIR to switch to a directory
32
- DL3008 # Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
43
- DL3018 # Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
5-
- SC2086 # Double quote to prevent globbing and word splitting.

.shellcheckrc

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

Makefile

Lines changed: 128 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,161 @@
1-
build-all: build-alpine build-centos build-amazonlinux build-fedora build-debian build-ubuntu
1+
FORCE=1
2+
BUILD_CMD=./bin/docker-build.sh
3+
PUSH_CMD=./bin/docker-push.sh
4+
TEST_CMD=./bin/test.sh
5+
SEC_CMD=./bin/test-security.sh
26

3-
build-alpine:
4-
./bin/docker-build.sh alpine 1
7+
################################################################################
8+
# UTILITIES
9+
################################################################################
10+
auto-update: generate-supported-versions generate-dockerfiles update-tags
511

6-
build-centos:
7-
./bin/docker-build.sh centos 1
12+
auto-update-and-commit: auto-update
13+
set -eux
14+
git config --global user.name "fabiocicerchia"
15+
git config --global user.email "[email protected]"
16+
git add -A
17+
git commit -m "Automated updates"
18+
set +x
19+
git remote set-url --push origin "https://fabiocicerchia:${GH_TOKEN}@github.com/fabiocicerchia/nginx-lua.git"
20+
set -x
21+
git push origin HEAD:master
22+
23+
generate-supported-versions:
24+
./bin/generate-supported-versions.sh
25+
26+
generate-dockerfiles:
27+
./bin/generate-dockerfiles.sh
28+
29+
update-tags:
30+
./bin/generate_tags.py | tee docs/TAGS.md
31+
32+
update-readme:
33+
./bin/update-readme.sh
34+
35+
benchmark:
36+
./bin/benchmark.sh
37+
38+
################################################################################
39+
# GENERIC
40+
################################################################################
41+
42+
all: build-all test-all push-all
43+
44+
################################################################################
45+
# BUILD
46+
################################################################################
47+
48+
build-all: build-alpine build-amazonlinux build-centos build-debian build-fedora build-ubuntu
49+
50+
build-alpine:
51+
$(BUILD_CMD) alpine $(FORCE)
852

953
build-amazonlinux:
10-
./bin/docker-build.sh amazonlinux 1
54+
$(BUILD_CMD) amazonlinux $(FORCE)
1155

12-
build-fedora:
13-
./bin/docker-build.sh fedora 1
56+
build-centos:
57+
$(BUILD_CMD) centos $(FORCE)
1458

1559
build-debian:
16-
./bin/docker-build.sh debian 1
60+
$(BUILD_CMD) debian $(FORCE)
61+
62+
build-fedora:
63+
$(BUILD_CMD) fedora $(FORCE)
1764

1865
build-ubuntu:
19-
./bin/docker-build.sh ubuntu 1
66+
$(BUILD_CMD) ubuntu $(FORCE)
2067

21-
build-all-minimal: build-alpine-minimal build-centos-minimal build-amazonlinux-minimal build-fedora-minimal build-debian-minimal build-ubuntu-minimal
68+
################################################################################
69+
# BUILD MINIMAL
70+
################################################################################
2271

23-
build-alpine-minimal:
24-
./bin/docker-build.sh alpine 1 0
72+
build-all-minimal: build-alpine-minimal build-amazonlinux-minimal build-centos-minimal build-debian-minimal build-fedora-minimal build-ubuntu-minimal
2573

26-
build-centos-minimal:
27-
./bin/docker-build.sh centos 1 0
74+
build-alpine-minimal:
75+
$(BUILD_CMD) alpine $(FORCE) 0
2876

2977
build-amazonlinux-minimal:
30-
./bin/docker-build.sh amazonlinux 1 0
78+
$(BUILD_CMD) amazonlinux $(FORCE) 0
3179

32-
build-fedora-minimal:
33-
./bin/docker-build.sh fedora 1 0
80+
build-centos-minimal:
81+
$(BUILD_CMD) centos $(FORCE) 0
3482

3583
build-debian-minimal:
36-
./bin/docker-build.sh debian 1 0
84+
$(BUILD_CMD) debian $(FORCE) 0
85+
86+
build-fedora-minimal:
87+
$(BUILD_CMD) fedora $(FORCE) 0
3788

3889
build-ubuntu-minimal:
39-
./bin/docker-build.sh ubuntu 1 0
90+
$(BUILD_CMD) ubuntu $(FORCE) 0
4091

41-
push-all: push-alpine push-centos push-amazonlinux push-fedora push-debian push-ubuntu
92+
################################################################################
93+
# TESTING
94+
################################################################################
4295

43-
push-alpine:
44-
./bin/docker-push.sh alpine 1
96+
test-all: test-alpine test-amazonlinux test-centos test-debian test-fedora test-ubuntu test-lint test-security
4597

46-
push-centos:
47-
./bin/docker-push.sh centos 1
98+
test-alpine:
99+
$(TEST_CMD) alpine
48100

49-
push-amazonlinux:
50-
./bin/docker-push.sh amazonlinux 1
101+
test-amazonlinux:
102+
$(TEST_CMD) amazonlinux
51103

52-
push-fedora:
53-
./bin/docker-push.sh fedora 1
104+
test-centos:
105+
$(TEST_CMD) centos
54106

55-
push-debian:
56-
./bin/docker-push.sh debian 1
107+
test-debian:
108+
$(TEST_CMD) debian
57109

58-
push-ubuntu:
59-
./bin/docker-push.sh ubuntu 1
110+
test-fedora:
111+
$(TEST_CMD) fedora
60112

61-
test-all: test-alpine test-centos test-amazonlinux test-fedora test-debian test-ubuntu
113+
test-ubuntu:
114+
$(TEST_CMD) ubuntu
62115

63-
test-alpine:
64-
./bin/test.sh alpine 1
116+
test-lint:
117+
./bin/test-lint.sh
65118

66-
test-centos:
67-
./bin/test.sh centos 1
119+
test-security: test-security-alpine test-security-amazonlinux test-security-centos test-security-debian test-security-fedora test-security-ubuntu
68120

69-
test-amazonlinux:
70-
./bin/test.sh amazonlinux 1
121+
test-security-alpine:
122+
$(SEC_CMD) alpine
71123

72-
test-fedora:
73-
./bin/test.sh fedora 1
124+
test-security-amazonlinux:
125+
$(SEC_CMD) amazonlinux
74126

75-
test-debian:
76-
./bin/test.sh debian 1
127+
test-security-centos:
128+
$(SEC_CMD) centos
77129

78-
test-ubuntu:
79-
./bin/test.sh ubuntu 1
130+
test-security-debian:
131+
$(SEC_CMD) debian
132+
133+
test-security-fedora:
134+
$(SEC_CMD) fedora
135+
136+
test-security-ubuntu:
137+
$(SEC_CMD) ubuntu
138+
139+
################################################################################
140+
# PUSH
141+
################################################################################
142+
143+
push-all: push-alpine push-amazonlinux push-centos push-debian push-fedora push-ubuntu
144+
145+
push-alpine:
146+
$(PUSH_CMD) alpine $(FORCE)
147+
148+
push-amazonlinux:
149+
$(PUSH_CMD) amazonlinux $(FORCE)
150+
151+
push-centos:
152+
$(PUSH_CMD) centos $(FORCE)
153+
154+
push-debian:
155+
$(PUSH_CMD) debian $(FORCE)
156+
157+
push-fedora:
158+
$(PUSH_CMD) fedora $(FORCE)
159+
160+
push-ubuntu:
161+
$(PUSH_CMD) ubuntu $(FORCE)

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,12 @@ Nginx 1.19+ with Lua support based on Alpine Linux, Amazon Linux, CentOS, Debian
2020
## Supported tags and respective `Dockerfile` links
2121

2222
<!-- START_SUPPORTED_TAGS -->
23-
- [`1-alpine3.12.0`,`1.19-alpine3.12.0`,`1.19.3-alpine3.12.0`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/alpine/3.12.0/Dockerfile)
24-
- [`1`,`1.19`,`1.19.3`,`alpine`,`1-alpine`,`1.19-alpine`,`1.19.3-alpine`,`1-alpine3.12.1`,`1-alpine3.12.1`,`1.19-alpine3.12.1`,`1.19.3-alpine3.12.1`,`latest`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/alpine/3.12.1/Dockerfile)
25-
- [`1-amazonlinux2.0.20200602.0`,`1.19-amazonlinux2.0.20200602.0`,`1.19.3-amazonlinux2.0.20200602.0`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/amazonlinux/2.0.20200602.0/Dockerfile)
26-
- [`amazonlinux`,`1-amazonlinux`,`1.19-amazonlinux`,`1.19.3-amazonlinux`,`1-amazonlinux2.0.20200722.0`,`1-amazonlinux2.0.20200722.0`,`1.19-amazonlinux2.0.20200722.0`,`1.19.3-amazonlinux2.0.20200722.0`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/amazonlinux/2.0.20200722.0/Dockerfile)
27-
- [`1-centos8.1.1911`,`1.19-centos8.1.1911`,`1.19.3-centos8.1.1911`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/centos/8.1.1911/Dockerfile)
28-
- [`centos`,`1-centos`,`1.19-centos`,`1.19.3-centos`,`1-centos8.2.2004`,`1-centos8.2.2004`,`1.19-centos8.2.2004`,`1.19.3-centos8.2.2004`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/centos/8.2.2004/Dockerfile)
29-
- [`1-debian10.5-slim`,`1.19-debian10.5-slim`,`1.19.3-debian10.5-slim`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/debian/10.5-slim/Dockerfile)
30-
- [`debian`,`1-debian`,`1.19-debian`,`1.19.3-debian`,`1-debian10.6-slim`,`1-debian10.6-slim`,`1.19-debian10.6-slim`,`1.19.3-debian10.6-slim`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/debian/10.6-slim/Dockerfile)
31-
- [`1-fedora33`,`1.19-fedora33`,`1.19.3-fedora33`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/fedora/33/Dockerfile)
32-
- [`fedora`,`1-fedora`,`1-fedora34`,`1-fedora34`,`1.19-fedora`,`1.19-fedora34`,`1.19.3-fedora`,`1.19.3-fedora34`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/fedora/34/Dockerfile)
33-
- [`1-ubuntu20.04`,`1.19-ubuntu20.04`,`1.19.3-ubuntu20.04`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/ubuntu/20.04/Dockerfile)
34-
- [`ubuntu`,`1-ubuntu`,`1.19-ubuntu`,`1-ubuntu20.10`,`1-ubuntu20.10`,`1.19.3-ubuntu`,`1.19-ubuntu20.10`,`1.19.3-ubuntu20.10`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/ubuntu/20.10/Dockerfile)
23+
- [`1`,`1.19`,`1.19.3`,`alpine`,`1-alpine`,`1.19-alpine`,`1.19.3-alpine`,`1-alpine3.12.1`,`1-alpine3.12.1`,`1.19-alpine3.12.1`,`1.19.3-alpine3.12.1`,`latest`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/alpine/3.12.1/Dockerfile)
24+
- [`amazonlinux`,`1-amazonlinux`,`1.19-amazonlinux`,`1.19.3-amazonlinux`,`1-amazonlinux2.0.20200722.0`,`1-amazonlinux2.0.20200722.0`,`1.19-amazonlinux2.0.20200722.0`,`1.19.3-amazonlinux2.0.20200722.0`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/amazonlinux/2.0.20200722.0/Dockerfile)
25+
- [`centos`,`1-centos`,`1.19-centos`,`1.19.3-centos`,`1-centos8.2.2004`,`1-centos8.2.2004`,`1.19-centos8.2.2004`,`1.19.3-centos8.2.2004`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/centos/8.2.2004/Dockerfile)
26+
- [`debian`,`1-debian`,`1.19-debian`,`1.19.3-debian`,`1-debian10.6-slim`,`1-debian10.6-slim`,`1.19-debian10.6-slim`,`1.19.3-debian10.6-slim`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/debian/10.6-slim/Dockerfile)
27+
- [`fedora`,`1-fedora`,`1-fedora34`,`1-fedora34`,`1.19-fedora`,`1.19-fedora34`,`1.19.3-fedora`,`1.19.3-fedora34`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/fedora/34/Dockerfile)
28+
- [`ubuntu`,`1-ubuntu`,`1.19-ubuntu`,`1-ubuntu20.10`,`1-ubuntu20.10`,`1.19.3-ubuntu`,`1.19-ubuntu20.10`,`1.19.3-ubuntu20.10`](https://github.com/fabiocicerchia/nginx-lua/blob/master/nginx/1.19.3/ubuntu/20.10/Dockerfile)
3529
<!-- END_SUPPORTED_TAGS -->
3630

3731
**Note:** The full list of supported/unsupported tags can be found on [docs/TAGS.md](https://github.com/fabiocicerchia/nginx-lua/blob/master/docs/TAGS.md).
@@ -183,6 +177,24 @@ $ docker run -d -p 80:80 --read-only -v $(pwd)/nginx-cache:/var/cache/nginx -v $
183177
```
184178
If you have a more advanced configuration that requires nginx to write to other locations, simply add more volume mounts to those locations.
185179

180+
### Running nginx in debug mode
181+
182+
Images since version 1.19.3 come with `nginx-debug` binary that produces verbose output when using higher log levels. It can be used with simple CMD substitution:
183+
184+
```console
185+
$ docker run --name my-nginx -v /host/path/nginx.conf:/etc/nginx/nginx.conf:ro -d fabiocicerchia/nginx-lua nginx-debug -g 'daemon off;'
186+
```
187+
188+
Similar configuration in docker-compose.yml may look like this:
189+
190+
```yaml
191+
web:
192+
image: fabiocicerchia/nginx-lua
193+
volumes:
194+
- ./nginx.conf:/etc/nginx/nginx.conf:ro
195+
command: [nginx-debug, '-g', 'daemon off;']
196+
```
197+
186198
### Entrypoint quiet logs
187199

188200
Since version 1.19.0, a verbose entrypoint was added. It provides information on what's happening during container startup. You can silence this output by setting environment variable `NGINX_ENTRYPOINT_QUIET_LOGS`:

bin/auto_update.sh

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

bin/benchmark.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
2-
# shellcheck disable=SC2086,SC2178,SC1091,SC2004
32

43
# VM: ubuntu-s-1vcpu-2gb-fra1-01
54

bin/docker-build.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/bin/bash
2-
# shellcheck disable=SC2086,SC2178,SC1091,SC2004,SC2046
2+
# shellcheck disable=SC1091,SC2086
33

44
source supported_versions
55

66
function docker_tag_exists() {
7-
curl --silent -f -lSL https://index.docker.io/v1/repositories/$1/tags/$2 > /dev/null
7+
curl --silent -f -lSL "https://index.docker.io/v1/repositories/$1/tags/$2" > /dev/null
88
echo $?
99
}
1010

@@ -17,19 +17,19 @@ function build() {
1717
DEFAULT=$6
1818
EXTENDED=$7
1919

20-
DOCKERFILE_PATH=nginx/$NGINX_VER/$OS/$OS_VER
21-
DOCKERFILE=$DOCKERFILE_PATH/Dockerfile
20+
DOCKERFILE_PATH="nginx/$NGINX_VER/$OS/$OS_VER"
21+
DOCKERFILE="$DOCKERFILE_PATH/Dockerfile"
2222

23-
MAJOR=$(echo $NGINX_VER | cut -d '.' -f 1)
24-
MINOR=$MAJOR.$(echo $NGINX_VER | cut -d '.' -f 2)
25-
PATCH=$NGINX_VER
23+
MAJOR=$(echo "$NGINX_VER" | cut -d '.' -f 1)
24+
MINOR="$MAJOR".$(echo "$NGINX_VER" | cut -d '.' -f 2)
25+
PATCH="$NGINX_VER"
2626

27-
if [ "$FORCE" == "0" ] && [ $(docker_tag_exists fabiocicerchia/nginx-lua $PATCH-$OS$OS_VER) == 0 ]; then
27+
if [ "$FORCE" == "0" ] && [ "$(docker_tag_exists fabiocicerchia/nginx-lua "$PATCH-$OS$OS_VER")" == "0" ]; then
2828
return
2929
fi
3030

3131
SUFFIX=""
32-
if [ $EXTENDED -eq 0 ]; then
32+
if [ "$EXTENDED" -eq "0" ]; then
3333
SUFFIX="-minimal"
3434
fi
3535

@@ -59,23 +59,23 @@ function build() {
5959
BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
6060
VCS_REF=$(git rev-parse --short HEAD)
6161
time docker build \
62-
--build-arg EXTENDED=$EXTENDED \
63-
--build-arg BUILD_DATE=$BUILD_DATE \
64-
--build-arg VCS_REF=$VCS_REF \
62+
--build-arg EXTENDED_IMAGE="$EXTENDED_IMAGE" \
63+
--build-arg BUILD_DATE="$BUILD_DATE" \
64+
--build-arg VCS_REF="$VCS_REF" \
6565
$TAGS \
66-
-f $DOCKERFILE .
66+
-f "$DOCKERFILE" .
6767
}
6868

69-
set -x
69+
set -eux
7070

7171
OS=$1
7272
FORCE=0
7373
if [ "$2" == "1" ]; then
7474
FORCE=1
7575
fi
76-
EXTENDED=1
76+
EXTENDED_IMAGE=1
7777
if [ "$2" == "0" ]; then
78-
EXTENDED=0
78+
EXTENDED_IMAGE=0
7979
fi
8080
VERSIONS=()
8181
if [ "$OS" == "alpine" ]; then VERSIONS=("${ALPINE[@]}")
@@ -87,7 +87,7 @@ elif [ "$OS" == "ubuntu" ]; then VERSIONS=("${UBUNTU[@]}")
8787
fi
8888

8989
NLEN=${#NGINX[@]}
90-
for (( I=0; I<$NLEN; I++ )); do
90+
for (( I=0; I<NLEN; I++ )); do
9191
NGINX_VER="${NGINX[$I]}"
9292

9393
VER_TAGS=0
@@ -100,13 +100,13 @@ for (( I=0; I<$NLEN; I++ )); do
100100
if [ "$OS" == "alpine" ]; then DEFAULT=1; fi
101101

102102
DLEN=${#VERSIONS[@]}
103-
for (( J=0; J<$DLEN; J++ )); do
103+
for (( J=0; J<DLEN; J++ )); do
104104
OS_VER="${VERSIONS[$J]}"
105105
OS_TAGS=0
106106
if [ "$((J+1))" == "$DLEN" ]; then
107107
OS_TAGS=1
108108
fi
109-
build $NGINX_VER $OS $OS_VER $VER_TAGS $OS_TAGS $DEFAULT $EXTENDED
109+
build "$NGINX_VER" "$OS" "$OS_VER" $VER_TAGS $OS_TAGS $DEFAULT $EXTENDED_IMAGE
110110
done
111111

112112
done

0 commit comments

Comments
 (0)