mirror of
https://github.com/dokku/buildpack-nginx.git
synced 2026-04-30 11:37:35 +00:00
refactor: extract shared nginx build config to conf/nginx-configure-flags
Moves version variables and configure flags to a single sourced file, eliminating duplication between bin/compile and the release workflow.
This commit is contained in:
56
.github/workflows/release.yml
vendored
56
.github/workflows/release.yml
vendored
@ -13,61 +13,23 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Extract version variables
|
|
||||||
id: versions
|
|
||||||
run: |
|
|
||||||
NGINX_VERSION=$(grep '^NGINX_VERSION=' bin/compile | cut -d'"' -f2)
|
|
||||||
PCRE_VERSION=$(grep '^PCRE_VERSION=' bin/compile | cut -d'"' -f2)
|
|
||||||
ZLIB_VERSION=$(grep '^ZLIB_VERSION=' bin/compile | cut -d'"' -f2)
|
|
||||||
echo "NGINX_VERSION=$NGINX_VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "PCRE_VERSION=$PCRE_VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "ZLIB_VERSION=$ZLIB_VERSION" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Download source tarballs
|
- name: Download source tarballs
|
||||||
run: |
|
run: |
|
||||||
|
source "$GITHUB_WORKSPACE/conf/nginx-configure-flags"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
curl -sSL "https://nginx.org/download/nginx-${{ steps.versions.outputs.NGINX_VERSION }}.tar.gz" | tar xz
|
curl -sSL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" | tar xz
|
||||||
curl -sSL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${{ steps.versions.outputs.PCRE_VERSION }}/pcre2-${{ steps.versions.outputs.PCRE_VERSION }}.tar.gz" | tar xz
|
curl -sSL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE_VERSION}/pcre2-${PCRE_VERSION}.tar.gz" | tar xz
|
||||||
curl -sSL "https://github.com/madler/zlib/archive/v${{ steps.versions.outputs.ZLIB_VERSION }}.tar.gz" | tar xz
|
curl -sSL "https://github.com/madler/zlib/archive/v${ZLIB_VERSION}.tar.gz" | tar xz
|
||||||
|
|
||||||
- name: Compile nginx
|
- name: Compile nginx
|
||||||
run: |
|
run: |
|
||||||
cd /tmp/nginx-${{ steps.versions.outputs.NGINX_VERSION }}
|
source "$GITHUB_WORKSPACE/conf/nginx-configure-flags"
|
||||||
|
cd /tmp/nginx-${NGINX_VERSION}
|
||||||
./configure \
|
./configure \
|
||||||
--with-cpu-opt=generic \
|
|
||||||
--prefix=/tmp/nginx-build \
|
--prefix=/tmp/nginx-build \
|
||||||
--with-pcre=../pcre2-${{ steps.versions.outputs.PCRE_VERSION }} \
|
--with-pcre=../pcre2-${PCRE_VERSION} \
|
||||||
--sbin-path=. \
|
--with-zlib=../zlib-${ZLIB_VERSION} \
|
||||||
--pid-path=./nginx.pid \
|
"${NGINX_CONFIGURE_FLAGS[@]}"
|
||||||
--conf-path=./nginx.conf \
|
|
||||||
--with-ld-opt="-static" \
|
|
||||||
--with-http_stub_status_module \
|
|
||||||
--with-http_gzip_static_module \
|
|
||||||
--with-file-aio \
|
|
||||||
--with-zlib=../zlib-${{ steps.versions.outputs.ZLIB_VERSION }} \
|
|
||||||
--with-pcre \
|
|
||||||
--with-cc-opt="-O2 -static -static-libgcc" \
|
|
||||||
--without-http_ssi_module \
|
|
||||||
--without-http_userid_module \
|
|
||||||
--without-http_access_module \
|
|
||||||
--without-http_autoindex_module \
|
|
||||||
--without-http_geo_module \
|
|
||||||
--without-http_map_module \
|
|
||||||
--without-http_split_clients_module \
|
|
||||||
--without-http_referer_module \
|
|
||||||
--without-http_fastcgi_module \
|
|
||||||
--without-http_uwsgi_module \
|
|
||||||
--without-http_scgi_module \
|
|
||||||
--without-http_memcached_module \
|
|
||||||
--without-http_empty_gif_module \
|
|
||||||
--without-http_browser_module \
|
|
||||||
--without-http_upstream_ip_hash_module \
|
|
||||||
--without-http_upstream_least_conn_module \
|
|
||||||
--without-http_upstream_keepalive_module \
|
|
||||||
--without-mail_pop3_module \
|
|
||||||
--without-mail_imap_module \
|
|
||||||
--without-mail_smtp_module \
|
|
||||||
--with-http_realip_module
|
|
||||||
sed -i "/CFLAGS/s/ \-O //g" objs/Makefile
|
sed -i "/CFLAGS/s/ \-O //g" objs/Makefile
|
||||||
make -j"$(nproc)"
|
make -j"$(nproc)"
|
||||||
cp objs/nginx /tmp/nginx-linux-amd64
|
cp objs/nginx /tmp/nginx-linux-amd64
|
||||||
|
|||||||
42
bin/compile
42
bin/compile
@ -3,16 +3,10 @@
|
|||||||
set -eo pipefail
|
set -eo pipefail
|
||||||
[[ $TRACE ]] && set -x
|
[[ $TRACE ]] && set -x
|
||||||
|
|
||||||
# https://nginx.org/en/download.html
|
# shellcheck source=conf/nginx-configure-flags
|
||||||
NGINX_VERSION="1.29.8"
|
source "$(cd "$(dirname "$0")" && cd .. && pwd)/conf/nginx-configure-flags"
|
||||||
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz"
|
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz"
|
||||||
# https://github.com/PCRE2Project/pcre2/releases
|
|
||||||
PCRE_VERSION="10.47"
|
|
||||||
PCRE_TARBALL="pcre2-${PCRE_VERSION}.tar.gz"
|
PCRE_TARBALL="pcre2-${PCRE_VERSION}.tar.gz"
|
||||||
# https://github.com/gliderlabs/sigil/releases
|
|
||||||
SIGIL_VERSION="0.11.5"
|
|
||||||
# https://github.com/madler/zlib/releases
|
|
||||||
ZLIB_VERSION="1.3.2"
|
|
||||||
ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz"
|
ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz"
|
||||||
BUILDPACK_REPO="dokku/heroku-buildpack-nginx"
|
BUILDPACK_REPO="dokku/heroku-buildpack-nginx"
|
||||||
|
|
||||||
@ -103,40 +97,10 @@ else
|
|||||||
echo "-----> Compiling static nginx binary"
|
echo "-----> Compiling static nginx binary"
|
||||||
mkdir "$BUILD_DIR/nginx"
|
mkdir "$BUILD_DIR/nginx"
|
||||||
suppress ./configure \
|
suppress ./configure \
|
||||||
--with-cpu-opt=generic \
|
|
||||||
--prefix="$BUILD_DIR/nginx" \
|
--prefix="$BUILD_DIR/nginx" \
|
||||||
--with-pcre=../pcre2-${PCRE_VERSION} \
|
--with-pcre=../pcre2-${PCRE_VERSION} \
|
||||||
--sbin-path=. \
|
|
||||||
--pid-path=./nginx.pid \
|
|
||||||
--conf-path=./nginx.conf \
|
|
||||||
--with-ld-opt="-static" \
|
|
||||||
--with-http_stub_status_module \
|
|
||||||
--with-http_gzip_static_module \
|
|
||||||
--with-file-aio \
|
|
||||||
--with-zlib=../zlib-${ZLIB_VERSION} \
|
--with-zlib=../zlib-${ZLIB_VERSION} \
|
||||||
--with-pcre \
|
"${NGINX_CONFIGURE_FLAGS[@]}"
|
||||||
--with-cc-opt="-O2 -static -static-libgcc" \
|
|
||||||
--without-http_ssi_module \
|
|
||||||
--without-http_userid_module \
|
|
||||||
--without-http_access_module \
|
|
||||||
--without-http_autoindex_module \
|
|
||||||
--without-http_geo_module \
|
|
||||||
--without-http_map_module \
|
|
||||||
--without-http_split_clients_module \
|
|
||||||
--without-http_referer_module \
|
|
||||||
--without-http_fastcgi_module \
|
|
||||||
--without-http_uwsgi_module \
|
|
||||||
--without-http_scgi_module \
|
|
||||||
--without-http_memcached_module \
|
|
||||||
--without-http_empty_gif_module \
|
|
||||||
--without-http_browser_module \
|
|
||||||
--without-http_upstream_ip_hash_module \
|
|
||||||
--without-http_upstream_least_conn_module \
|
|
||||||
--without-http_upstream_keepalive_module \
|
|
||||||
--without-mail_pop3_module \
|
|
||||||
--without-mail_imap_module \
|
|
||||||
--without-mail_smtp_module \
|
|
||||||
--with-http_realip_module
|
|
||||||
|
|
||||||
sed -i "/CFLAGS/s/ \-O //g" objs/Makefile
|
sed -i "/CFLAGS/s/ \-O //g" objs/Makefile
|
||||||
|
|
||||||
|
|||||||
47
conf/nginx-configure-flags
Normal file
47
conf/nginx-configure-flags
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Shared nginx build configuration
|
||||||
|
# Sourced by bin/compile and .github/workflows/release.yml
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
|
# https://nginx.org/en/download.html
|
||||||
|
NGINX_VERSION="1.29.8"
|
||||||
|
# https://github.com/PCRE2Project/pcre2/releases
|
||||||
|
PCRE_VERSION="10.47"
|
||||||
|
# https://github.com/gliderlabs/sigil/releases
|
||||||
|
SIGIL_VERSION="0.11.5"
|
||||||
|
# https://github.com/madler/zlib/releases
|
||||||
|
ZLIB_VERSION="1.3.2"
|
||||||
|
|
||||||
|
NGINX_CONFIGURE_FLAGS=(
|
||||||
|
--with-cpu-opt=generic
|
||||||
|
--sbin-path=.
|
||||||
|
--pid-path=./nginx.pid
|
||||||
|
--conf-path=./nginx.conf
|
||||||
|
"--with-ld-opt=-static"
|
||||||
|
--with-http_stub_status_module
|
||||||
|
--with-http_gzip_static_module
|
||||||
|
--with-file-aio
|
||||||
|
--with-pcre
|
||||||
|
"--with-cc-opt=-O2 -static -static-libgcc"
|
||||||
|
--without-http_ssi_module
|
||||||
|
--without-http_userid_module
|
||||||
|
--without-http_access_module
|
||||||
|
--without-http_autoindex_module
|
||||||
|
--without-http_geo_module
|
||||||
|
--without-http_map_module
|
||||||
|
--without-http_split_clients_module
|
||||||
|
--without-http_referer_module
|
||||||
|
--without-http_fastcgi_module
|
||||||
|
--without-http_uwsgi_module
|
||||||
|
--without-http_scgi_module
|
||||||
|
--without-http_memcached_module
|
||||||
|
--without-http_empty_gif_module
|
||||||
|
--without-http_browser_module
|
||||||
|
--without-http_upstream_ip_hash_module
|
||||||
|
--without-http_upstream_least_conn_module
|
||||||
|
--without-http_upstream_keepalive_module
|
||||||
|
--without-mail_pop3_module
|
||||||
|
--without-mail_imap_module
|
||||||
|
--without-mail_smtp_module
|
||||||
|
--with-http_realip_module
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user