Static nginx (with lua and rtmp) in busybox image
1.2K
The static nginx binary is built with the following Dockerfile;
FROM tianon/centos:6.5
RUN yum update -y
RUN yum install -y git curl tar bzip2 make gcc-c++ zlib-devel openssl-static glibc-static
ENV LUAJIT_LIB /usr/lib
ENV LUAJIT_INC /usr/include/luajit-2.0
# install LuaJIT
RUN cd /usr/local/src && \
curl -O http://luajit.org/download/LuaJIT-2.0.3.tar.gz && \
tar xf LuaJIT-2.0.3.tar.gz && \
cd LuaJIT-2.0.3 && \
make amalg && \
make PREFIX=/usr install
ENV NGINX_VERSION 1.6.0
ENV OPENSSL_VERSION 1.0.1h
ENV PCRE_VERSION 8.34
ENV ZLIB_VERSION 1.2.8
RUN cd /usr/local/src && \
curl http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${PCRE_VERSION}.tar.gz | tar xvzf - && \
curl http://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz | tar xvzf - &&\
curl http://zlib.net/zlib-${ZLIB_VERSION}.tar.gz | tar xvzf - &&\
curl http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar xvzf -
# Download nginx modules
RUN cd /usr/local/src && \
git clone https://github.com/simpl/ngx_devel_kit.git && \
git clone https://github.com/chaoslawful/lua-nginx-module.git && \
git clone https://github.com/arut/nginx-rtmp-module.git
# configure, make and install nginx
RUN cd /usr/local/src/nginx-${NGINX_VERSION} && \
./configure \
--conf-path=/conf/nginx.conf \
--pid-path=/var/run/nginx.pid \
--prefix=/ \
--sbin-path=/ \
--with-cc-opt="-O2 -static -static-libgcc" \
--with-cpu-opt=generic \
--with-file-aio \
--with-http_gzip_static_module \
--with-http_spdy_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-ld-opt="-static -Wl,-rpath,$LUAJIT_LIB" \
--with-openssl=../openssl-${OPENSSL_VERSION} \
--with-openssl-opt=no-krb5 \
--without-http_access_module \
--without-http_auth_basic_module \
--without-http_autoindex_module \
--without-http_browser_module \
--without-http_charset_module \
--without-http_empty_gif_module \
--without-http_fastcgi_module \
--without-http_geo_module \
--without-http_map_module \
--without-http_memcached_module \
--without-http_referer_module \
--without-http_scgi_module \
--without-http_split_clients_module \
--without-http_ssi_module \
--without-http_upstream_ip_hash_module \
--without-http_upstream_keepalive_module \
--without-http_upstream_least_conn_module \
--without-http_userid_module \
--without-http_uwsgi_module \
--without-mail_imap_module \
--without-mail_pop3_module \
--without-mail_smtp_module \
--with-pcre=../pcre-${PCRE_VERSION} \
--with-zlib=../zlib-${ZLIB_VERSION} \
--add-module=/usr/local/src/lua-nginx-module \
--add-module=/usr/local/src/nginx-rtmp-module \
--add-module=/usr/local/src/ngx_devel_kit && \
make && \
make install
CMD ["/nginx", "-g", "daemon off;"]
VOLUME /conf
VOLUME /logs
VOLUME /html
EXPOSE 80
EXPOSE 443
RUN tar -hcvf /var/nginx.tar /lib64/libnss_files.so.2 /lib64/libc.so.6 /lib64/ld-linux-x86-64.so.2 nginx conf
Then /var/nginx.tar is taken and added to a busybox image;
FROM busybox:latest
ADD nginx.tar /
RUN mkdir /logs
VOLUME /logs
VOLUME /conf
CMD /nginx -c /conf/nginx.conf
Then that was pushed to the repo.
Will come back to tidy this up once https://github.com/docker/docker/pull/8021 is merged.
Content type
Image
Digest
sha256:f91f8277b…
Size
7.3 MB
Last updated
almost 11 years ago
docker pull ddub/nginx