自动部署静态页面

This commit is contained in:
yangyu 2019-06-04 17:14:53 +08:00
parent cbde5d7e57
commit 7da5576b2a
2 changed files with 43 additions and 0 deletions

35
nginx/1.17.0/Dockerfile Normal file
View File

@ -0,0 +1,35 @@
FROM centos:7
MAINTAINER Yang <yangyufans@qq.com>
ENV NGINX_VERSION=1.17.0
RUN yum install -y wget make gcc pcre-devel gzip zlib zlib-devel openssl openssl-devel
RUN echo "ZONE=Asia/Shanghai" > /etc/sysconfig/clock && \
rm -rf /etc/localtime && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN yum -y install kde-l10n-Chinese telnet reinstall glibc-common && \
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
ENV LC_ALL "zh_CN.UTF-8"
RUN cd / && wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz \
&& tar -zxvf nginx-$NGINX_VERSION.tar.gz \
&& rm -rf nginx-$NGINX_VERSION.tar.gz \
&& cd nginx-$NGINX_VERSION \
&& ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module \
&& make \
&& make install
RUN mkdir -p /nginx/conf && mkdir /nginx/logs/ && mkdir /nginx/www
EXPOSE 80 443
COPY start.sh /
RUN chmod 777 /start.sh
CMD ["/start.sh"]

8
nginx/1.17.0/start.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ ! -e /nginx/conf/nginx.conf ]; then
cp /usr/local/nginx/conf/nginx.conf /nginx/conf
sed -i "s/mime.types/\/usr\/local\/nginx\/conf\/mime.types/" /nginx/conf/nginx.conf
fi
/usr/local/nginx/sbin/nginx -c /nginx/conf/nginx.conf -g 'daemon off;'