echo "*" > .dockerignore
vi Dockerfile
FROM centos:7
MAINTAINER "Geray <1690014753@qq.com>"
RUN yum -y install telnet wget iproute net-tools \
kde-l10n-Chinese reinstall glibc-common && \
# 安装nginx依赖
yum -y install gcc gcc-c++ openssl-devel pcre-devel gd-devel make && \
yum clean all && \
rm -rf /var/cache/yum/* && \
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 && \
cat /dev/null > /etc/locale.conf && echo "LC_ALL=\"zh_CN.UTF-8\"" > /etc/locale.conf
ENV NGINX_VERSION 1.18.0
RUN wget https://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \
tar -xf nginx-$NGINX_VERSION.tar.gz && \
cd nginx-$NGINX_VERSION && \
./configure --prefix=/usr/local/nginx \
--with-http_ssl_module \
--with-http_stub_status_module && \
make -j 4 && make install && \
#rm -rf /usr/local/nginx/html/* && \
echo "ok" > /usr/local/nginx/html/status.html && \
cd / && rm -rf nginx-$NGINX_VERSION*
#env
ENV TZ "Asia/Shanghai"
#ENV LANG en_US.UTF-8
ENV LANG zh_CN.UTF-8
ENV PATH $PATH:/usr/local/nginx/sbin
WORKDIR /usr/local/nginx
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
export NGINX_VERSION=1.18.0
docker build -t geray/nginx:v${NGINX_VERSION} .