2019-06-20 13:07:42 +02:00
|
|
|
FROM ubuntu
|
|
|
|
|
|
|
|
|
|
# Install prerequisites for Nginx compile
|
|
|
|
|
RUN apt-get update && \
|
2019-06-20 13:49:12 +02:00
|
|
|
apt-get install -y wget tar gcc libpcre3-dev zlib1g-dev make libssl-dev liblua5.1-0 libluajit-5.1-dev curl jq
|
2019-06-20 13:07:42 +02:00
|
|
|
|
|
|
|
|
# Download Nginx
|
|
|
|
|
WORKDIR /tmp
|
|
|
|
|
RUN wget http://nginx.org/download/nginx-1.16.0.tar.gz -O nginx.tar.gz && \
|
|
|
|
|
mkdir nginx && \
|
|
|
|
|
tar xf nginx.tar.gz -C nginx --strip-components=1
|
|
|
|
|
|
|
|
|
|
# Download Nginx modules
|
|
|
|
|
RUN wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz -O ngx_devel_kit.tar.gz && \
|
|
|
|
|
mkdir ngx_devel_kit && \
|
2019-06-20 13:49:12 +02:00
|
|
|
tar xf ngx_devel_kit.tar.gz -C ngx_devel_kit --strip-components=1 && \
|
|
|
|
|
wget https://github.com/openresty/set-misc-nginx-module/archive/v0.32.tar.gz -O set-misc-nginx-module.tar.gz && \
|
2019-06-20 13:07:42 +02:00
|
|
|
mkdir set-misc-nginx-module && \
|
2019-06-20 13:49:12 +02:00
|
|
|
tar xf set-misc-nginx-module.tar.gz -C set-misc-nginx-module --strip-components=1 && \
|
|
|
|
|
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.15.tar.gz -O lua-nginx-module.tar.gz && \
|
2019-06-20 13:07:42 +02:00
|
|
|
mkdir lua-nginx-module && \
|
2019-06-20 13:49:12 +02:00
|
|
|
tar xf lua-nginx-module.tar.gz -C lua-nginx-module --strip-components=1 && \
|
|
|
|
|
wget https://github.com/openresty/luajit2/archive/v2.1-20190530.tar.gz -O luajit2.tar.gz && \
|
|
|
|
|
mkdir luajit2 && \
|
|
|
|
|
tar xf luajit2.tar.gz -C luajit2 --strip-components=1 && \
|
|
|
|
|
cd /tmp/luajit2 && \
|
|
|
|
|
make && \make install
|
|
|
|
|
|
2019-06-20 13:07:42 +02:00
|
|
|
|
|
|
|
|
# Build Nginx
|
|
|
|
|
WORKDIR nginx
|
2019-06-20 13:49:12 +02:00
|
|
|
RUN LUAJIT_LIB=/usr/local/lib LUAJIT_INC=/usr/local/include/luajit-2.1 ./configure --sbin-path=/usr/local/sbin \
|
2019-06-20 13:07:42 +02:00
|
|
|
--conf-path=/etc/nginx/nginx.conf \
|
|
|
|
|
--pid-path=/var/run/nginx.pid \
|
|
|
|
|
--error-log-path=/var/log/nginx/error.log \
|
|
|
|
|
--http-log-path=/var/log/nginx/access.log \
|
|
|
|
|
--with-http_ssl_module \
|
2019-06-20 13:49:12 +02:00
|
|
|
--with-ld-opt="-Wl,-rpath,/usr/local/lib" \
|
2019-06-20 13:07:42 +02:00
|
|
|
--add-module=/tmp/ngx_devel_kit \
|
|
|
|
|
--add-module=/tmp/set-misc-nginx-module \
|
|
|
|
|
--add-module=/tmp/lua-nginx-module && \
|
|
|
|
|
make && \
|
|
|
|
|
make install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Expose ports
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
|
|
# forward request and error logs to docker log collector
|
|
|
|
|
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
|
|
|
|
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
|
|
|
|
|
|
|
|
|
# Apply Nginx config
|
|
|
|
|
ADD nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
ADD start.sh /start.sh
|
|
|
|
|
|
|
|
|
|
# Set default command
|
|
|
|
|
ENTRYPOINT ["/start.sh"]
|