Files
openrestyextended/Dockerfile
2021-05-23 21:46:50 +00:00

89 lines
2.9 KiB
Docker

ARG IMAGE_BASE_TAG=buster-slim
FROM debian:${IMAGE_BASE_TAG}
ARG RESTY_VERSION="1.19.3.1"
ARG RESTY_CONFIG_OPTIONS="\
--with-compat \
--with-file-aio \
--with-http_addition_module \
--with-http_auth_request_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_geoip_module=dynamic \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_image_filter_module=dynamic \
--with-http_mp4_module \
--with-http_random_index_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_slice_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-http_v2_module \
--with-http_xslt_module=dynamic \
--with-ipv6 \
--with-mail \
--with-mail_ssl_module \
--with-md5-asm \
--with-pcre-jit \
--with-sha1-asm \
--with-stream \
--with-stream_ssl_module \
--with-threads \
--add-module=/tmp/nginx-auth-ldap-master \
"
WORKDIR /tmp
# Get the openresty /nginx source
RUN cd /tmp
# Install all required packages
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y \
build-essential \
wget \
curl \
unzip \
gzip \
&& apt-get install -y libpcre3-dev \
libssl-dev zlib1g-dev libxslt-dev \
libgd-dev libgeoip-dev libldap2-dev\
&& apt-get install -y procps luarocks \
&& rm -rf /var/lib/apt/lists/* \
&& wget https://openresty.org/download/openresty-1.19.3.1.tar.gz -O openresty.tar.gz \
&& tar xvf openresty.tar.gz && mv openresty-1.19.3.1 openresty \
&& wget https://github.com/kvspb/nginx-auth-ldap/archive/refs/heads/master.zip && unzip -o master.zip && rm master.zip \
\
&& cd openresty \
&& ./configure ${RESTY_CONFIG_OPTIONS} \
&& make && make install \
&& ln -sf /dev/stdout /usr/local/openresty/nginx/logs/access.log \
&& ln -sf /dev/stderr /usr/local/openresty/nginx/logs/error.log \
&& mkdir -p /var/run/openresty \
&& cd /usr/local \
&& rm -rf /tmp/*
COPY nginx.conf /usr/local/openresty/nginx/conf/nginx.conf
#RUN apt-get install liblua5.3-dev
WORKDIR /usr/local/openresty
RUN luarocks install --tree lua_modules luaposix && \
luarocks install --tree lua_modules etlua && \
luarocks install --tree lua_modules luafilesystem && \
luarocks install lua-resty-auto-ssl
#RUN useradd -ms /bin/bash www-data
#USER www-data
RUN mkdir -p /etc/resty-auto-ssl/storage/ \
&& chown -R www-data /etc/resty-auto-ssl
RUN openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 \
-subj '/CN=sni-support-required-for-valid-ssl' \
-keyout /etc/ssl/resty-auto-ssl-fallback.key \
-out /etc/ssl/resty-auto-ssl-fallback.crt
copy ./conf/* /etc/nginx/conf.d/
copy ./snippets/* /usr/local/openresty/nginx/conf/
CMD ["/usr/local/openresty/bin/openresty", "-g" ,"daemon off;"];