build-nginx/Dockerfile

92 lines
3.2 KiB
Docker

# latest = LTS
FROM ubuntu:latest as base
MAINTAINER ben kristinsson <ben@sudo.is>
ENV TZ=UTC
ENV DEBIAN_FRONTEND=noninteractive
RUN mkdir /nginx && chown www-data:www-data /nginx
FROM base as builder
RUN apt-get update && \
apt-get install -y build-essential libgd-dev libgeoip-dev libpcre2-dev libssl-dev \
ruby ruby-dev rubygems git && \
gem install --no-document fpm
USER www-data
WORKDIR /nginx
COPY --chown=www-data:www-data nginx-git /nginx/nginx-git
WORKDIR /nginx/nginx-git
RUN mkdir /nginx/target && \
mkdir /nginx/dist && \
chmod +x auto/configure && \
./auto/configure --prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--modules-path=/usr/lib/nginx/modules \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--user=www-data \
--group=www-data \
--build=sudo.is \
--builddir=build \
--with-select_module \
--with-poll_module \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_image_filter_module=dynamic \
--with-http_geoip_module=dynamic \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_auth_request_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-perl=/usr/bin/perl \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--with-mail=dynamic \
--with-mail_ssl_module \
--with-stream=dynamic \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-stream_geoip_module=dynamic \
--with-stream_ssl_preread_module \
--with-compat \
--with-pcre \
--with-pcre-jit \
--with-openssl-opt=no-nextprotoneg \
--with-debug
RUN make -j8
RUN make install DESTDIR=/nginx/target && \
mkdir -p /nginx/target/var/lib/nginx && \
ldd /nginx/target/usr/sbin/nginx
WORKDIR /nginx/dist
RUN fpm -s dir -t deb -n nginx -v 0.1 -C /nginx/target && \
ls /nginx/dist
FROM base as final
COPY --from=builder /nginx/dist/nginx_0.1_amd64.deb /nginx/dist/nginx_0.1_amd64.deb
RUN dpkg -i /nginx/dist/nginx_0.1_amd64.deb