heroku / heroku-buildpack-nginx

Run NGINX in a Heroku app
244 stars 787 forks source link

Update to Nginx 1.26, link against system libraries, strip nginx binary #122

Closed dzuelke closed 3 months ago

dzuelke commented 3 months ago

We should have started linking against base image versions of zlib and PCRE long ago. We are specifically linking against libpcre3 (8.x), because some regex rules have changed in the newer libpcre2 (10.x).

Also now stripping the nginx binary (but obviously not nginx-debug).

In total, we get a reasonable size reduction:

Before:

% ls -la nginx-heroku-2*.tgz
-rw-r--r--  1 dzuelke  staff  5638356 May 17 13:50 nginx-heroku-20.tgz
-rw-r--r--  1 dzuelke  staff  4559004 May 17 13:50 nginx-heroku-22.tgz
% tar tzvf nginx-heroku-20.tgz
-rw-r--r--  0 root   root     5349 Feb 21 01:58 ./mime.types
-rwxr-xr-x  0 root   root  6705408 Feb 21 01:58 ./nginx
-rwxr-xr-x  0 root   root  6870296 Feb 21 01:58 ./nginx-debug
% tar tzvf nginx-heroku-22.tgz
-rw-r--r--  0 root   root     5349 Feb 21 02:00 ./mime.types
-rwxr-xr-x  0 root   root  4937400 Feb 21 02:00 ./nginx
-rwxr-xr-x  0 root   root  5094584 Feb 21 02:00 ./nginx-debug

After:

% ls -la nginx-heroku-2*.tgz
-rw-r--r--  1 dzuelke  staff  3181649 May 17 13:51 nginx-heroku-20.tgz
-rw-r--r--  1 dzuelke  staff  2638964 May 17 13:51 nginx-heroku-22.tgz
% tar tzvf nginx-heroku-20.tgz
-rw-r--r--  0 root   root     5349 May 17 13:30 ./mime.types
-rwxr-xr-x  0 root   root   973624 May 17 13:30 ./nginx
-rwxr-xr-x  0 root   root  6746392 May 17 13:30 ./nginx-debug
% tar tzvf nginx-heroku-22.tgz
-rw-r--r--  0 root   root     5349 May 17 13:30 ./mime.types
-rwxr-xr-x  0 root   root   973592 May 17 13:30 ./nginx
-rwxr-xr-x  0 root   root  4974032 May 17 13:30 ./nginx-debug

GUS-W-15794944