Skip to content

Instantly share code, notes, and snippets.

@paderinandrey
Created November 23, 2020 15:36
Show Gist options
  • Select an option

  • Save paderinandrey/92bf0c9781dbd56b08fb9b1f805c8569 to your computer and use it in GitHub Desktop.

Select an option

Save paderinandrey/92bf0c9781dbd56b08fb9b1f805c8569 to your computer and use it in GitHub Desktop.
FROM ruby:2.6.3-slim-buster
SHELL ["/bin/bash", "-c"]
ARG NGINX_VERSION=1.14.2
# Install dependencies
COPY ./ngx_Aptfile /tmp/Aptfile
RUN apt-get update -qq && DEBIAN_FRONTEND=noninteractive apt-get -yq dist-upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
build-essential \
$(cat /tmp/Aptfile | xargs) && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log
RUN git clone https://github.com/matsumotory/ngx_mruby.git && \
cd ngx_mruby && \
sh ./build.sh
#https://github.com/geerlingguy/ansible-role-java/issues/64
# Install wallarm
RUN curl -fsSL https://repo.wallarm.com/wallarm.gpg | apt-key add - \
&& echo 'deb http://repo.wallarm.com/debian/wallarm-node buster/2.16/' | tee /etc/apt/sources.list.d/wallarm.list \
&& apt update \
&& mkdir -p /usr/share/man/man1 \
&& apt install -y nginx-module-wallarm wallarm-node-nginx
RUN wget https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \
tar zxvf nginx-$NGINX_VERSION.tar.gz && \
cd nginx-$NGINX_VERSION && \
./configure \
--with-cc-opt='-g -O2 -fdebug-prefix-map=/build/nginx-tBUzFN/nginx-1.14.2=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Wdate-time -D_FORTIFY_SOURCE=2' \
--with-ld-opt='-Wl,-z,relro -Wl,-z,now -fPIC' \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--modules-path=/usr/lib/nginx/modules \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
--http-log-path=/var/log/nginx/access.log \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--lock-path=/var/lock/nginx.lock \
--pid-path=/var/run/nginx.pid \
--http-scgi-temp-path=/var/lib/nginx/scgi \
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
--with-stream_ssl_preread_module \
--with-pcre-jit \
--with-http_gzip_static_module \
--with-http_ssl_module \
--with-ipv6 \
--with-debug \
--with-threads \
--with-http_realip_module \
--with-http_auth_request_module \
--with-http_v2_module \
--with-http_dav_module \
--with-http_slice_module \
--with-http_addition_module \
--with-http_geoip_module=dynamic \
--with-http_gunzip_module \
--with-http_image_filter_module=dynamic \
--with-http_sub_module \
--with-http_xslt_module=dynamic \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-mail=dynamic \
--with-mail_ssl_module \
--without-http_browser_module \
--without-http_memcached_module \
--without-http_referer_module \
--without-http_scgi_module \
--without-http_split_clients_module \
--with-http_stub_status_module \
--without-http_ssi_module \
--without-http_userid_module \
--without-http_uwsgi_module \
--add-module=/ngx_mruby \
--add-module=/ngx_mruby/dependence/ngx_devel_kit && \
make && \
make install && \
make clean
RUN rm -rf /$NGINX_VERSION.tar.gz && \
mkdir -p /var/lib/nginx
# Forward request logs to Docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
EXPOSE 80
EXPOSE 443
EXPOSE 8053
STOPSIGNAL SIGTERM
CMD [ "nginx", "-g", "daemon off;" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment