FROM registry.openanolis.cn/openanolis/anolisos:8.6

ADD nginx-1.24.0.tar.gz /usr/local/

RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
    source /etc/profile && \
    echo "Asia/Shanghai" > /etc/timezone && \
    yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel make && \
    yum -y update libnghttp2 && \
    useradd -M nginx && \
    cd /usr/local/nginx-1.24.0/ && \
    ./configure --with-http_ssl_module --with-http_secure_link_module && make && make install && \
    yum -y remove gcc-c++ && \
    rm -rf /var/cache/yum/* && \
    mkdir -pv /usr/local/nginx/conf/conf.d && \
    mkdir -pv /storage/nginx_logs/ && chown -R nginx:nginx /storage/nginx_logs && \
    echo "ok" > /usr/local/nginx/html/index.html && \
    rm -rf /usr/local/nginx-1.24.0

COPY nginx.conf /usr/local/nginx/conf/
COPY localhost.conf /usr/local/nginx/conf/conf.d/
EXPOSE 80 443
CMD ["/usr/local/nginx/sbin/nginx","-g","daemon off;"]