aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-09-21 09:55:22 -0400
committerGalen Guyer <galen@galenguyer.com>2022-09-21 09:55:22 -0400
commit84557cec1b6d8c7ea915ec00802a12e6c3251c3d (patch)
treea266fb7fff9313ee6eecd2e502a55f4d8f3863d2
parent63dd7d6deb5a71e2daf2b8f2ed26cfbfab259dac (diff)
Dynamically get PCRE2 version, generate README with tags
-rw-r--r--README.md16
-rw-r--r--alpine/autoindex/Dockerfile10
-rw-r--r--alpine/base/Dockerfile8
-rw-r--r--alpine/spa/Dockerfile10
-rwxr-xr-xbake.sh20
5 files changed, 50 insertions, 14 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..557b992
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# docker-nginx
+automatic builds of nginx with multiple architectures and rootless support
+
+## tags
+- alpine-mainline: latest, alpine, alpine3.16.2, mainline, mainline-alpine, mainline-alpine3.16.2, 1.23.1, 1.23.1-alpine, 1.23.1-alpine3.16.2
+- alpine-mainline-autoindex: autoindex, alpine-autoindex, alpine3.16.2-autoindex, mainline-autoindex, mainline-alpine-autoindex, mainline-alpine3.16.2-autoindex, 1.23.1-autoindex, 1.23.1-alpine-autoindex, 1.23.1-alpine3.16.2-autoindex
+- alpine-mainline-spa: spa, alpine-spa, alpine3.16.2-spa, mainline-spa, mainline-alpine-spa, mainline-alpine3.16.2-spa, 1.23.1-spa, 1.23.1-alpine-spa, 1.23.1-alpine3.16.2-spa
+- alpine-stable: stable, stable-alpine, stable-alpine3.16.2, 1.22.0, 1.22.0-alpine, 1.22.0-alpine3.16.2
+- alpine-stable-autoindex: stable-autoindex, stable-alpine-autoindex, stable-alpine3.16.2-autoindex, 1.22.0-autoindex, 1.22.0-alpine-autoindex, 1.22.0-alpine3.16.2-autoindex
+- alpine-stable-spa: stable-spa, stable-alpine-spa, stable-alpine3.16.2-spa, 1.22.0-spa, 1.22.0-alpine-spa, 1.22.0-alpine3.16.2-spa
+
+## build options
+ALPINE_VER: 3.16.2
+NGINX_MAINLINE: 1.23.1
+NGINX_STABLE: 1.22.0
+PCRE2_VER: pcre2-10.40
diff --git a/alpine/autoindex/Dockerfile b/alpine/autoindex/Dockerfile
index 017c255..dd0fe5a 100644
--- a/alpine/autoindex/Dockerfile
+++ b/alpine/autoindex/Dockerfile
@@ -5,12 +5,12 @@ ARG TARGETVARIANT=""
ARG ALPINE_VER="latest"
FROM alpine:"$ALPINE_VER" AS builder
-RUN apk add gcc g++ git curl make linux-headers tar gzip geoip-dev gd-dev libxslt-dev pcre-dev perl-dev
+RUN apk add gcc g++ git curl make linux-headers tar gzip geoip-dev gd-dev libxslt-dev pcre-dev perl-dev
WORKDIR /src/pcre2/
-ARG PCRE2_VER="10.40"
-RUN curl -L -O "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VER/pcre2-$PCRE2_VER.tar.gz"
-RUN tar xzf "/src/pcre2/pcre2-$PCRE2_VER.tar.gz"
+ARG PCRE2_VER="pcre2-10.40"
+RUN curl -L -O "https://github.com/PCRE2Project/pcre2/releases/download/$PCRE2_VER/$PCRE2_VER.tar.gz"
+RUN tar xzf "/src/pcre2/$PCRE2_VER.tar.gz"
WORKDIR /src/nginx
ARG NGINX_VER
@@ -32,7 +32,7 @@ RUN ./configure --prefix=/usr/share/nginx \
--group=www-data \
--with-threads \
--with-file-aio \
- --with-pcre="/src/pcre2/pcre2-$PCRE2_VER" \
+ --with-pcre="/src/pcre2/$PCRE2_VER" \
--with-pcre-jit \
--with-http_addition_module \
--without-http_fastcgi_module \
diff --git a/alpine/base/Dockerfile b/alpine/base/Dockerfile
index b75c903..dd0fe5a 100644
--- a/alpine/base/Dockerfile
+++ b/alpine/base/Dockerfile
@@ -8,9 +8,9 @@ FROM alpine:"$ALPINE_VER" AS builder
RUN apk add gcc g++ git curl make linux-headers tar gzip geoip-dev gd-dev libxslt-dev pcre-dev perl-dev
WORKDIR /src/pcre2/
-ARG PCRE2_VER="10.40"
-RUN curl -L -O "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VER/pcre2-$PCRE2_VER.tar.gz"
-RUN tar xzf "/src/pcre2/pcre2-$PCRE2_VER.tar.gz"
+ARG PCRE2_VER="pcre2-10.40"
+RUN curl -L -O "https://github.com/PCRE2Project/pcre2/releases/download/$PCRE2_VER/$PCRE2_VER.tar.gz"
+RUN tar xzf "/src/pcre2/$PCRE2_VER.tar.gz"
WORKDIR /src/nginx
ARG NGINX_VER
@@ -32,7 +32,7 @@ RUN ./configure --prefix=/usr/share/nginx \
--group=www-data \
--with-threads \
--with-file-aio \
- --with-pcre="/src/pcre2/pcre2-$PCRE2_VER" \
+ --with-pcre="/src/pcre2/$PCRE2_VER" \
--with-pcre-jit \
--with-http_addition_module \
--without-http_fastcgi_module \
diff --git a/alpine/spa/Dockerfile b/alpine/spa/Dockerfile
index 017c255..dd0fe5a 100644
--- a/alpine/spa/Dockerfile
+++ b/alpine/spa/Dockerfile
@@ -5,12 +5,12 @@ ARG TARGETVARIANT=""
ARG ALPINE_VER="latest"
FROM alpine:"$ALPINE_VER" AS builder
-RUN apk add gcc g++ git curl make linux-headers tar gzip geoip-dev gd-dev libxslt-dev pcre-dev perl-dev
+RUN apk add gcc g++ git curl make linux-headers tar gzip geoip-dev gd-dev libxslt-dev pcre-dev perl-dev
WORKDIR /src/pcre2/
-ARG PCRE2_VER="10.40"
-RUN curl -L -O "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-$PCRE2_VER/pcre2-$PCRE2_VER.tar.gz"
-RUN tar xzf "/src/pcre2/pcre2-$PCRE2_VER.tar.gz"
+ARG PCRE2_VER="pcre2-10.40"
+RUN curl -L -O "https://github.com/PCRE2Project/pcre2/releases/download/$PCRE2_VER/$PCRE2_VER.tar.gz"
+RUN tar xzf "/src/pcre2/$PCRE2_VER.tar.gz"
WORKDIR /src/nginx
ARG NGINX_VER
@@ -32,7 +32,7 @@ RUN ./configure --prefix=/usr/share/nginx \
--group=www-data \
--with-threads \
--with-file-aio \
- --with-pcre="/src/pcre2/pcre2-$PCRE2_VER" \
+ --with-pcre="/src/pcre2/$PCRE2_VER" \
--with-pcre-jit \
--with-http_addition_module \
--without-http_fastcgi_module \
diff --git a/bake.sh b/bake.sh
index 78eb435..a7886e2 100755
--- a/bake.sh
+++ b/bake.sh
@@ -30,6 +30,10 @@ echo "using nginx stable version $nginx_stable..." >&2
nginx_mainline="${NGINX_MAINLINE:-$(curl -sSL https://nginx.org/en/download.html | grep -P '(\/download\/nginx-\d+\.\d+\.\d+\.tar\.gz)' -o | uniq | head -n1 | grep -o -P '\d+\.\d+\.\d+')}"
echo "using nginx mainline version $nginx_mainline..." >&2
+# retrieve latest pcre2 version
+pcre="${PCRE:-$(curl -sSL https://api.github.com/repos/PCRE2Project/pcre2/releases/latest | jq -r '.name')}"
+echo "using pcre2 version $pcre..." >&2
+
# pass core count into container for build process
core_count="${CORE_COUNT:-$(nproc)}"
echo "using $core_count cores..." >&2
@@ -40,6 +44,22 @@ export CORE_COUNT="$core_count"
export REGISTRY="$registry"
export NGINX_MAINLINE="$nginx_mainline"
export NGINX_STABLE="$nginx_stable"
+export PCRE2_VER="$pcre"
docker buildx bake \
$(if [ "${REGISTRY}" != "local" ]; then echo "--push"; fi) \
"$@"
+
+echo "# docker-nginx" > README.md
+echo -e "automatic builds of nginx with multiple architectures and rootless support\n" >> README.md
+echo "## tags" >> README.md
+target_info="$(docker buildx bake --print | jq '.target')"
+targets="$(echo $target_info | jq -r '.|keys[]')"
+for target in $targets; do
+ tags="$(echo "$target_info" | jq -r '[."'"$target"'".tags|.[]|split(":")|.[1]]|join(", ")')"
+ echo "- $target: $tags" >> README.md
+done
+echo -e "\n## build options" >> README.md
+echo "ALPINE_VER: $ALPINE_VER" >> README.md
+echo "NGINX_MAINLINE: $NGINX_MAINLINE" >> README.md
+echo "NGINX_STABLE: $NGINX_STABLE" >> README.md
+echo "PCRE2_VER: $PCRE2_VER" >> README.md