Run once:
# ./build-ubuntu32.sh
$ cp make_openresty.sh resty-dyn.patch /home/build/x{64,86}/
Everytime: change VERSION in build.sh
$ ./build.sh 64
$ ./build.sh 32
deb package will be generated under /home/build/$arch/openresrt-$VERSION
#!/bin/bash -ex | |
### Build a docker image for ubuntu i386. | |
### settings | |
arch=i386 | |
suite=${1:-xenial} | |
chroot_dir="/var/chroot/$suite" | |
apt_mirror='http://archive.ubuntu.com/ubuntu' | |
docker_image="i386/ubuntu:${1:-latest}" | |
### make sure that the required tools are installed | |
packages="debootstrap dchroot apparmor" | |
which docker || packages="$packages docker.io" | |
apt-get install -y $packages | |
### install a minbase system with debootstrap | |
export DEBIAN_FRONTEND=noninteractive | |
debootstrap --variant=minbase --arch=$arch $suite $chroot_dir $apt_mirror | |
### update the list of package sources | |
cat <<EOF > $chroot_dir/etc/apt/sources.list | |
deb $apt_mirror $suite main restricted universe multiverse | |
deb $apt_mirror $suite-updates main restricted universe multiverse | |
deb $apt_mirror $suite-backports main restricted universe multiverse | |
deb http://security.ubuntu.com/ubuntu $suite-security main restricted universe multiverse | |
EOF | |
### install ubuntu-minimal | |
cp /etc/resolv.conf $chroot_dir/etc/resolv.conf | |
#mount -o bind /proc $chroot_dir/proc | |
chroot $chroot_dir apt-get update | |
chroot $chroot_dir apt-get -y upgrade | |
chroot $chroot_dir apt-get -y install ubuntu-minimal | |
### cleanup | |
chroot $chroot_dir apt-get autoclean | |
chroot $chroot_dir apt-get clean | |
chroot $chroot_dir apt-get autoremove | |
rm $chroot_dir/etc/resolv.conf | |
### kill any processes that are running on chroot | |
#chroot_pids=$(for p in /proc/*/root; do ls -l $p; done | grep $chroot_dir | cut -d'/' -f3) | |
#test -z "$chroot_pids" || (kill -9 $chroot_pids; sleep 2) | |
### unmount /proc | |
#umount $chroot_dir/proc | |
### create a tar archive from the chroot directory | |
tar cfz ubuntu.tgz -C $chroot_dir . | |
### import this tar archive into a docker image: | |
cat ubuntu.tgz | docker import - $docker_image | |
# ### push image to Docker Hub | |
# docker push $docker_image | |
### cleanup | |
rm ubuntu.tgz | |
rm -rf $chroot_dir |
#!/bin/bash | |
if [[ "$1" -eq "64" ]]; then | |
arch=x64 | |
image=ubuntu:xenial | |
docker_opts= | |
else | |
arch=x86 | |
image=i386/ubuntu | |
docker_opts="--security-opt seccomp:unconfined" | |
fi | |
pushd /home/build/$arch | |
sudo rm -rf openresty-* | |
wget https://openresty.org/download/openresty-$VERSION.tar.gz && tar zxvf openresty-$VERSION.tar.gz | |
popd | |
echo "FROM $image | |
RUN echo \"echo 'deb http://ppa.launchpad.net/ondrej/php/ubuntu xenial main' >> /etc/apt/sources.list && \ | |
apt-get update && \ | |
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C && \ | |
apt install wget libgd-dev libxslt-dev libpcre3-dev libxml2-dev libzip-dev libssl-dev libexpat-dev libgeoip-dev checkinstall -y --force-yes && \ | |
/build/make_openresty.sh $VERSION\" > /build.sh && \ | |
chmod +x /build.sh | |
" | docker build -t build-temp - | |
docker run --rm $docker_opts -v /home/build/$arch:/build -w /build build-temp bash /build.sh | |
docker rmi build-temp |
#!/bin/bash | |
#cd ngx_openresty | |
#rm -rf ngx_openresty-* | |
#make | |
#rm *.tar.gz ../ngx_openresty-* -r | |
#mv ngx_openresty-* ../ | |
#cd .. | |
#cd openresty-*/bundle/nginx-*/ | |
#patch -p1 < ../../../nginx_upstream_check_module/check_1.9.2+.patch | |
#patch -p1 < ../../../nginx_tcp_proxy_module/tcp.patch | |
#cd ../../ | |
cd openresty-* | |
patch -p1 < ../resty-dyn.patch | |
./configure -j6 --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_gzip_static_module --with-threads --with-http_v2_module --with-http_sub_module --with-file-aio --with-stream --with-stream_ssl_module --with-http_stub_status_module --with-http_dav_module \ | |
--with-mail=dynamic --with-http_geoip_module=dynamic --with-http_image_filter_module=dynamic --with-http_xslt_module=dynamic \ | |
--add-dynamic-module=/build/nginx-unzip-module --add-dynamic-module=/build/ngx_cache_purge --add-dynamic-module=/build/nginx-rtmp-module | |
make -j6 | |
VERSION=$1 | |
echo > description-pak | |
checkinstall << EOF | |
n | |
1 | |
OpenResty | |
2 | |
openresty | |
3 | |
$VERSION | |
4 | |
1 | |
6 | |
httpd | |
10 | |
libssl1.0.2 | |
11 | |
openresty,resty,libluajit,nginx,nginx-common,nginx-extras | |
12 | |
nginx-light | |
13 | |
nginx,nginx-common,nginx-extras | |
EOF |
--- a/configure 2016-05-17 22:47:03.000000000 +0000 | |
+++ b/configure 2016-05-20 08:58:55.851600049 +0000 | |
@@ -69,25 +69,25 @@ | |
[ndk => 'ngx_devel_kit'], | |
[http_iconv => 'iconv-nginx-module', 'disabled'], | |
[http_echo => 'echo-nginx-module'], | |
- [http_xss => 'xss-nginx-module'], | |
+ [http_xss => 'xss-nginx-module', 'dynamic'], | |
[http_coolkit => 'ngx_coolkit'], | |
- [http_set_misc => 'set-misc-nginx-module'], | |
- [http_form_input => 'form-input-nginx-module'], | |
- [http_encrypted_session => 'encrypted-session-nginx-module'], | |
+ [http_set_misc => 'set-misc-nginx-module', 'dynamic'], | |
+ [http_form_input => 'form-input-nginx-module', 'dynamic'], | |
+ [http_encrypted_session => 'encrypted-session-nginx-module', 'dynamic'], | |
[http_drizzle => 'drizzle-nginx-module', 'disabled'], | |
[http_postgres => 'ngx_postgres', 'disabled'], | |
- [http_srcache => 'srcache-nginx-module'], | |
+ [http_srcache => 'srcache-nginx-module', 'dynamic'], | |
[http_lua => 'ngx_lua'], | |
- [http_lua_upstream => 'ngx_lua_upstream'], | |
- [http_headers_more => 'headers-more-nginx-module'], | |
- [http_array_var => 'array-var-nginx-module'], | |
- [http_memc => 'memc-nginx-module'], | |
- [http_redis2 => 'redis2-nginx-module'], | |
- [http_redis => 'redis-nginx-module'], | |
+ [http_lua_upstream => 'ngx_lua_upstream', 'dynamic'], | |
+ [http_headers_more => 'headers-more-nginx-module', 'dynamic'], | |
+ [http_array_var => 'array-var-nginx-module', 'dynamic'], | |
+ [http_memc => 'memc-nginx-module', 'dynamic'], | |
+ [http_redis2 => 'redis2-nginx-module', 'dynamic'], | |
+ [http_redis => 'redis-nginx-module', 'dynamic'], | |
#[http_upstream_keepalive => 'upstream-keepalive-nginx-module'], | |
#[http_auth_request => 'auth-request-nginx-module'], | |
- [http_rds_json => 'rds-json-nginx-module'], | |
- [http_rds_csv => 'rds-csv-nginx-module'], | |
+ [http_rds_json => 'rds-json-nginx-module', 'dynamic'], | |
+ [http_rds_csv => 'rds-csv-nginx-module', 'dynamic'], | |
); | |
my $without_resty_mods_regex; | |
@@ -995,7 +995,11 @@ | |
my $dir = auto_complete "../$prefix"; | |
- $opts_line .= " \\\n --add-module=$dir"; | |
+ if ($attr eq 'dynamic') { | |
+ $opts_line .= " \\\n --add-dynamic-module=$dir"; | |
+ } else { | |
+ $opts_line .= " \\\n --add-module=$dir"; | |
+ } | |
} | |
return $opts_line; |