FROM centos:7
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
WORKDIR /usr/local/src
ENV NG_VERSION=nginx-1.21.0
RUN yum -y install epel-release wget
RUN wget http://nginx.org/download/$NG_VERSION.tar.gz && tar xzvf $NG_VERSION.tar.gz 
RUN yum install -y gcc gcc-c++ glibc make autoconf openssl openssl-devel && yum install -y pcre-devel libxslt-devel gd-devel GeoIP GeoIP-devel GeoIP-data
RUN yum -y update bash bind-license binutils bzip2 cpio curl cyrus-sasl-lib dbus dbus-libs e2fsprogs elfutils-default-yama-scope elfutils-libelf elfutils-libs expat file-libs freetype gd glib2 glibc glibc-common gzip kpartx krb5 krb5-libs libcom_err libcurl libjpeg-turbo libpng libssh2 libtasn1 libX11 libX11-common libxml2 libxml2-python libXpm libxslt musl nspr nss nss-softokn nss-softokn-freebl nss-sysinit nss-tools nss-util openldap openssl openssl-libs perl perl-libs perl-macros perl-Pod-Escapes procps-ng python python-libs rpm rpm-build-libs rpm-libs rpm-python shared-mime-info sqlite systemd systemd-libs vim-minimal xz xz-libs zlib zstd-jni
#RUN yum -y update nss nss-tools nss-sysinit bind-license python openldap openssl-libs rpm expat glibc glib2 krb5-libs gzip libcurl cyrus-sasl-lib binutils bash systemd-libs libssh2 zlib kernel-headers
RUN yum clean all 
RUN useradd -M -s /sbin/nologin nginx 
WORKDIR /usr/local/src/$NG_VERSION 
RUN ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-file-aio --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module --with-http_image_filter_module --with-http_geoip_module --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_stub_status_module && make && make install
ENV PATH /usr/local/nginx/sbin:$PATH
ENV PATH /bin:/usr/bin:$PATH
ENTRYPOINT ["nginx"]
CMD ["-g","daemon off;"]
