1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| FROM centos:7
MAINTAINER peter<peter@gmail.com>
# 安装软件 RUN yum -y update && yum -y install vim tree htop tmux net-tools telnet wget curl supervistor autoconf git gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
# 创建用户 RUN groupadd tengine RUN useradd -g tengine tengine
# 定义Tengine版本号 ENV VERSION 2.2.3
# 下载并解压文件 RUN mkdir -p /usr/local/src/ ADD http://tengine.taobao.org/download/tengine-$VERSION.tar.gz /usr/local/src RUN tar -xvf /usr/local/src/tengine-$VERSION.tar.gz -C /usr/local/src/
# 创建安装目录 ENV TENGINE_HOME /usr/local/tengine RUN mkdir -p $TENGINE_HOME
# 进入解压目录 WORKDIR /usr/local/src/tengine-$VERSION
# 编译安装 RUN ./configure \ --user=tengine \ --group=tengine \ --prefix=$TENGINE_HOME \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_concat_module \ --with-http_gzip_static_module \ --with-http_stub_status_module \ --with-http_upstream_consistent_hash_module RUN make RUN make install
# 备份Tengine的配置文件 RUN mv $TENGINE_HOME/conf/nginx.conf $TENGINE_HOME/conf/nginx.conf.default
# 设置环境变量 ENV PATH $PATH:$TENGINE_HOME/sbin
# 创建WebApp目录 ENV WEB_APP /usr/share/tengine/html RUN mkdir -p $WEB_APP
# 设置默认工作目录 WORKDIR $WEB_APP
# 暴露端口 EXPOSE 80 EXPOSE 443
# 清理压缩包与解压文件 RUN rm -rf /usr/local/src/tengine*
CMD $TENGINE_HOME/sbin/nginx -g 'daemon off;' -c $TENGINE_HOME/conf/nginx.conf
|