Skip to content

Commit 60e21ce

Browse files
authored
use tgz to distribute binaries (#59)
* start building archives * use mime.types from stack archive * build new archives and cleanup old binaries * update bin/compile * update bin/compile * update changelog * Update changelog * update changelog
1 parent 41dddf4 commit 60e21ce

17 files changed

+44
-94
lines changed

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ build: build-cedar-14 build-heroku-16 build-heroku-18 build-heroku-20
22

33
build-cedar-14:
44
@echo "Building nginx in Docker for cedar-14..."
5-
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=cedar-14" -e "NGINX_VERSION=1.9.5" -e "PCRE_VERSION=8.37" -e "HEADERS_MORE_VERSION=0.261" -w /buildpack heroku/cedar:14 scripts/build_nginx /buildpack/bin/nginx-cedar-14 /buildpack/bin/nginx-debug-cedar-14
5+
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=cedar-14" -e "NGINX_VERSION=1.9.5" -e "PCRE_VERSION=8.37" -e "HEADERS_MORE_VERSION=0.261" -w /buildpack heroku/cedar:14 scripts/build_nginx /buildpack/nginx-cedar-14.tgz
66

77
build-heroku-16:
88
@echo "Building nginx in Docker for heroku-16..."
9-
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-16" -e "NGINX_VERSION=1.9.5" -e "PCRE_VERSION=8.37" -e "HEADERS_MORE_VERSION=0.261" -w /buildpack heroku/heroku:16-build scripts/build_nginx /buildpack/bin/nginx-heroku-16 /buildpack/bin/nginx-debug-heroku-16
9+
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-16" -e "NGINX_VERSION=1.9.5" -e "PCRE_VERSION=8.37" -e "HEADERS_MORE_VERSION=0.261" -w /buildpack heroku/heroku:16-build scripts/build_nginx /buildpack/nginx-heroku-16.tgz
1010

1111
build-heroku-18:
1212
@echo "Building nginx in Docker for heroku-18..."
13-
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -w /buildpack heroku/heroku:18-build scripts/build_nginx /buildpack/bin/nginx-heroku-18 /buildpack/bin/nginx-debug-heroku-18
13+
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-18" -w /buildpack heroku/heroku:18-build scripts/build_nginx /buildpack/nginx-heroku-18.tgz
1414

1515
build-heroku-20:
1616
@echo "Building nginx in Docker for heroku-20..."
17-
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-20" -w /buildpack heroku/heroku:20-build scripts/build_nginx /buildpack/bin/nginx-heroku-20 /buildpack/bin/nginx-debug-heroku-20
17+
@docker run -v $(shell pwd):/buildpack --rm -it -e "STACK=heroku-20" -w /buildpack heroku/heroku:20-build scripts/build_nginx /buildpack/nginx-heroku-20.tgz
1818

1919
shell:
2020
@echo "Opening heroku-18 shell..."

bin/compile

+28-12
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,47 @@
22

33
set -e
44

5-
mkdir -p "$1/bin/"
6-
cp "bin/nginx-$STACK" "$1/bin/nginx"
7-
cp "bin/nginx-debug-$STACK" "$1/bin/nginx-debug"
8-
nginx_version=$(./bin/nginx-$STACK -V 2>&1 | head -1 | awk '{ print $NF }')
5+
# clean up leaking environment
6+
unset GIT_DIR
7+
8+
# parse and derive params
9+
BUILD_DIR=$1
10+
CACHE_DIR=$2
11+
BUILDPACK_DIR="$(dirname "$(dirname "$0")")"
12+
13+
mkdir -p "$BUILD_DIR/bin/"
14+
mkdir -p "$BUILD_DIR/nginx"
15+
tar -zxvf "nginx-$STACK".tgz -C "$BUILD_DIR/nginx"
16+
17+
cp "$BUILD_DIR/nginx/nginx" "$BUILD_DIR/bin/nginx"
18+
cp "$BUILD_DIR/nginx/nginx-debug" "$BUILD_DIR/bin/nginx-debug"
19+
20+
nginx_version=$($BUILD_DIR/bin/nginx -V 2>&1 | head -1 | awk '{ print $NF }')
921
echo "-----> nginx-buildpack: Installed ${nginx_version} to app/bin"
10-
cp bin/start-nginx "$1/bin/"
22+
cp bin/start-nginx "$BUILD_DIR/bin/"
1123
echo '-----> nginx-buildpack: Added start-nginx to app/bin'
12-
cp bin/start-nginx-debug "$1/bin/"
24+
cp bin/start-nginx-debug "$BUILD_DIR/bin/"
1325
echo '-----> nginx-buildpack: Added start-nginx-debug to app/bin'
14-
cp bin/start-nginx-solo "$1/bin/"
26+
cp bin/start-nginx-solo "$BUILD_DIR/bin/"
1527
echo '-----> nginx-buildpack: Added start-nginx-solo to app/bin'
1628

17-
mkdir -p "$1/config"
29+
mkdir -p "$BUILD_DIR/config"
1830

19-
if [[ ! -f $1/config/mime.types ]]; then
20-
cp config/mime.types "$1/config/"
31+
if [[ ! -f $BUILD_DIR/config/mime.types ]]; then
32+
cp "$BUILD_DIR/nginx/mime.types" "$BUILD_DIR/config/"
2133
echo '-----> nginx-buildpack: Default mime.types copied to app/config/'
2234
else
2335
echo '-----> nginx-buildpack: Custom mime.types found in app/config.'
2436
fi
2537

26-
if [[ ! -f $1/config/nginx.conf.erb ]]; then
27-
cp config/nginx.conf.erb "$1/config/"
38+
if [[ ! -f $BUILD_DIR/config/nginx.conf.erb ]]; then
39+
cp config/nginx.conf.erb "$BUILD_DIR/config/"
2840
echo '-----> nginx-buildpack: Default config copied to app/config.'
2941
else
3042
echo '-----> nginx-buildpack: Custom config found in app/config.'
3143
fi
44+
45+
# cleanup
46+
rm -r "$BUILD_DIR/nginx"
47+
3248
exit 0

bin/nginx-cedar-14

-5.5 MB
Binary file not shown.

bin/nginx-debug-cedar-14

-5.65 MB
Binary file not shown.

bin/nginx-debug-heroku-16

-5.77 MB
Binary file not shown.

bin/nginx-debug-heroku-18

-5.67 MB
Binary file not shown.

bin/nginx-debug-heroku-20

-6.35 MB
Binary file not shown.

bin/nginx-heroku-16

-5.62 MB
Binary file not shown.

bin/nginx-heroku-18

-5.53 MB
Binary file not shown.

bin/nginx-heroku-20

-6.2 MB
Binary file not shown.

changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## unreleased
8+
### Added
9+
- [all] move to tgz to distribute binaries
10+
- [all] update mime.types to reflect the version that is included in the nginx distrubition
11+
712
## [1.4] - 2020-05-05
813
### Added
914
- [all] add nginx-debug binary

config/mime.types

-76
This file was deleted.

nginx-cedar-14.tgz

5.2 MB
Binary file not shown.

nginx-heroku-16.tgz

5.33 MB
Binary file not shown.

nginx-heroku-18.tgz

4.4 MB
Binary file not shown.

nginx-heroku-20.tgz

5.12 MB
Binary file not shown.

scripts/build_nginx

+7-2
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,10 @@ echo "Downloading $uuid4_url"
7070
make install
7171
)
7272

73-
cp /tmp/nginx/sbin/nginx $1
74-
cp /tmp/nginx-debug/sbin/nginx $2
73+
release_dir=$(mktemp -d /tmp/nginx.XXXXXXXXXX)
74+
75+
cp /tmp/nginx/sbin/nginx $release_dir/nginx
76+
cp /tmp/nginx-debug/sbin/nginx $release_dir/nginx-debug
77+
cp /tmp/nginx/conf/mime.types $release_dir/mime.types
78+
tar -zcvf /tmp/nginx-"${STACK}".tgz -C $release_dir .
79+
cp /tmp/nginx-"${STACK}".tgz $1

0 commit comments

Comments
 (0)