From 63dd7d6deb5a71e2daf2b8f2ed26cfbfab259dac Mon Sep 17 00:00:00 2001 From: Galen Guyer Date: Tue, 20 Sep 2022 17:26:38 -0400 Subject: Add support for multiple platforms and PCRE2 --- alpine/autoindex/Dockerfile | 12 ++++++------ alpine/base/Dockerfile | 14 +++++++------- alpine/spa/Dockerfile | 12 ++++++------ docker-bake.hcl | 6 ++++++ setup.sh | 5 +++++ 5 files changed, 30 insertions(+), 19 deletions(-) create mode 100755 setup.sh diff --git a/alpine/autoindex/Dockerfile b/alpine/autoindex/Dockerfile index ac8f582..017c255 100644 --- a/alpine/autoindex/Dockerfile +++ b/alpine/autoindex/Dockerfile @@ -7,15 +7,15 @@ 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 -WORKDIR /src/pcre -ARG PCRE_VER="8.44" -RUN curl -L -O "https://cfhcable.dl.sourceforge.net/project/pcre/pcre/$PCRE_VER/pcre-$PCRE_VER.tar.gz" -RUN tar xzf "/src/pcre/pcre-$PCRE_VER.tar.gz" +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" WORKDIR /src/nginx ARG NGINX_VER RUN curl -L -O "http://nginx.org/download/nginx-$NGINX_VER.tar.gz" -RUN tar xzf "nginx-$NGINX_VER.tar.gz" +RUN tar xzf "/src/nginx/nginx-$NGINX_VER.tar.gz" # configure and build nginx WORKDIR /src/nginx/nginx-"$NGINX_VER" @@ -32,7 +32,7 @@ RUN ./configure --prefix=/usr/share/nginx \ --group=www-data \ --with-threads \ --with-file-aio \ - --with-pcre="/src/pcre/pcre-$PCRE_VER" \ + --with-pcre="/src/pcre2/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 ac8f582..b75c903 100644 --- a/alpine/base/Dockerfile +++ b/alpine/base/Dockerfile @@ -5,17 +5,17 @@ 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/pcre -ARG PCRE_VER="8.44" -RUN curl -L -O "https://cfhcable.dl.sourceforge.net/project/pcre/pcre/$PCRE_VER/pcre-$PCRE_VER.tar.gz" -RUN tar xzf "/src/pcre/pcre-$PCRE_VER.tar.gz" +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" WORKDIR /src/nginx ARG NGINX_VER RUN curl -L -O "http://nginx.org/download/nginx-$NGINX_VER.tar.gz" -RUN tar xzf "nginx-$NGINX_VER.tar.gz" +RUN tar xzf "/src/nginx/nginx-$NGINX_VER.tar.gz" # configure and build nginx WORKDIR /src/nginx/nginx-"$NGINX_VER" @@ -32,7 +32,7 @@ RUN ./configure --prefix=/usr/share/nginx \ --group=www-data \ --with-threads \ --with-file-aio \ - --with-pcre="/src/pcre/pcre-$PCRE_VER" \ + --with-pcre="/src/pcre2/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 ac8f582..017c255 100644 --- a/alpine/spa/Dockerfile +++ b/alpine/spa/Dockerfile @@ -7,15 +7,15 @@ 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 -WORKDIR /src/pcre -ARG PCRE_VER="8.44" -RUN curl -L -O "https://cfhcable.dl.sourceforge.net/project/pcre/pcre/$PCRE_VER/pcre-$PCRE_VER.tar.gz" -RUN tar xzf "/src/pcre/pcre-$PCRE_VER.tar.gz" +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" WORKDIR /src/nginx ARG NGINX_VER RUN curl -L -O "http://nginx.org/download/nginx-$NGINX_VER.tar.gz" -RUN tar xzf "nginx-$NGINX_VER.tar.gz" +RUN tar xzf "/src/nginx/nginx-$NGINX_VER.tar.gz" # configure and build nginx WORKDIR /src/nginx/nginx-"$NGINX_VER" @@ -32,7 +32,7 @@ RUN ./configure --prefix=/usr/share/nginx \ --group=www-data \ --with-threads \ --with-file-aio \ - --with-pcre="/src/pcre/pcre-$PCRE_VER" \ + --with-pcre="/src/pcre2/pcre2-$PCRE2_VER" \ --with-pcre-jit \ --with-http_addition_module \ --without-http_fastcgi_module \ diff --git a/docker-bake.hcl b/docker-bake.hcl index 3c318ae..04eedf1 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -27,6 +27,7 @@ target "alpine-mainline" { NGINX_VER="${NGINX_MAINLINE}" CORE_COUNT="${CORE_COUNT}" } + platforms = ["linux/amd64", "linux/386", "linux/arm/v6", "linux/arm/v7", "linux/arm64"] tags = [ "${REGISTRY}/nginx:latest", "${REGISTRY}/nginx:alpine", @@ -47,6 +48,7 @@ target "alpine-stable" { NGINX_VER="${NGINX_STABLE}" CORE_COUNT="${CORE_COUNT}" } + platforms = ["linux/amd64", "linux/386", "linux/arm/v6", "linux/arm/v7", "linux/arm64"] tags = [ "${REGISTRY}/nginx:stable", "${REGISTRY}/nginx:stable-alpine", @@ -64,6 +66,7 @@ target "alpine-mainline-spa" { NGINX_VER="${NGINX_MAINLINE}" CORE_COUNT="${CORE_COUNT}" } + platforms = ["linux/amd64", "linux/386", "linux/arm/v6", "linux/arm/v7", "linux/arm64"] tags = [ "${REGISTRY}/nginx:spa", "${REGISTRY}/nginx:alpine-spa", @@ -84,6 +87,7 @@ target "alpine-stable-spa" { NGINX_VER="${NGINX_STABLE}" CORE_COUNT="${CORE_COUNT}" } + platforms = ["linux/amd64", "linux/386", "linux/arm/v6", "linux/arm/v7", "linux/arm64"] tags = [ "${REGISTRY}/nginx:stable-spa", "${REGISTRY}/nginx:stable-alpine-spa", @@ -101,6 +105,7 @@ target "alpine-mainline-autoindex" { NGINX_VER="${NGINX_MAINLINE}" CORE_COUNT="${CORE_COUNT}" } + platforms = ["linux/amd64", "linux/386", "linux/arm/v6", "linux/arm/v7", "linux/arm64"] tags = [ "${REGISTRY}/nginx:autoindex", "${REGISTRY}/nginx:alpine-autoindex", @@ -121,6 +126,7 @@ target "alpine-stable-autoindex" { NGINX_VER="${NGINX_STABLE}" CORE_COUNT="${CORE_COUNT}" } + platforms = ["linux/amd64", "linux/386", "linux/arm/v6", "linux/arm/v7", "linux/arm64"] tags = [ "${REGISTRY}/nginx:stable-autoindex", "${REGISTRY}/nginx:stable-alpine-autoindex", diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..ad1aee0 --- /dev/null +++ b/setup.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +# set up buildkit for multiple platforms +docker run --privileged --rm tonistiigi/binfmt --install all +docker buildx create --use --platform linux/arm64/v8,linux/arm/v7,linux/arm/v6,linux/amd64,linux/386 -- cgit v1.2.3