Last active
July 20, 2020 02:01
-
-
Save marklkelly/99be1a55a638ad874c12 to your computer and use it in GitHub Desktop.
OpenResty + HTTP2 (patch) + ngx_pagespeed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM zokeber/centos:latest | |
MAINTAINER Mark Kelly <[email protected]> | |
RUN touch /var/lib/rpm/* | |
RUN yum install -y deltarpm; yum clean all | |
RUN yum install -y sudo; yum clean all | |
# Set versions. Check http://openresty.org for latest version and bundled version of nginx. | |
ENV OPENRESTY_VERSION 1.9.3.1 | |
ENV NGINX_VERSION 1.9.3 | |
ENV OPENSSL_VERSION 1.0.2d | |
ENV NPS_VERSION 1.8.31.4 | |
# Install some pre-requisites | |
RUN yum install -y readline-devel pcre perl pcre-devel gcc zlib-devel patch unzip gcc-c++ make; yum clean all | |
RUN yum install -y glibc; yum clean all | |
RUN yum install -y tar; yum clean all | |
# Get OpenResty | |
RUN cd /usr/local/src/ \ | |
&& wget http://openresty.org/download/ngx_openresty-${OPENRESTY_VERSION}.tar.gz \ | |
&& tar vxf ngx_openresty-${OPENRESTY_VERSION}.tar.gz \ | |
&& wget https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ | |
&& tar vxf openssl-${OPENSSL_VERSION}.tar.gz \ | |
&& cd /usr/local/src/ngx_openresty-${OPENRESTY_VERSION}/bundle/nginx-${NGINX_VERSION} \ | |
&& wget http://nginx.org/patches/http2/patch.http2.txt \ | |
&& patch -p1 --dry-run < patch.http2.txt \ | |
&& patch -p1 < patch.http2.txt \ | |
&& wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip \ | |
&& unzip release-${NPS_VERSION}-beta.zip \ | |
&& cd ngx_pagespeed-release-${NPS_VERSION}-beta/ \ | |
&& wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz \ | |
&& tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/ | |
WORKDIR /usr/local/src/ngx_openresty-${OPENRESTY_VERSION} | |
RUN ./configure --with-http_ssl_module \ | |
--with-luajit \ | |
--with-openssl=/usr/local/src/openssl-${OPENSSL_VERSION} \ | |
--with-http_v2_module \ | |
--add-module=build/nginx-${NGINX_VERSION}/ngx_pagespeed-release-${NPS_VERSION}-beta \ | |
&& make && make install | |
# Check install. | |
RUN /usr/local/openresty/nginx/sbin/nginx -t | |
RUN /usr/local/openresty/nginx/sbin/nginx -V |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment