Tengine Dockerfile

  1. # 设置继承自创建的 sshd 镜像
  2. FROM sshd:dockerfile
  3. # 作者信息
  4. MAINTAINER waitfish from dockerpool.com(dwj_zz@163.com)
  5. # Let the conatiner know that there is no tty
  6. # 安装编译环境
  7. RUN apt-get update
  8. RUN apt-get install -y build-essential debhelper make autoconf automake patch
  9. RUN apt-get install -y dpkg-dev fakeroot pbuilder gnupg dh-make libssl-dev libpcre3-dev git-core
  10. RUN echo "Asia/Shangshi" > /etc/timezone && \
  11. dpkg-reconfigure -f noninteractive tzdata
  12. # 创建 Nginx 用户
  13. RUN adduser --disabled-login --gecos 'Tengine' nginx
  14. # tengine 安装的 shell 脚本
  15. WORKDIR /home/nginx
  16. RUN su nginx -c 'git clone https://github.com/alibaba/tengine.git'
  17. WORKDIR /home/nginx/tengine
  18. RUN su nginx -c 'mv packages/debian .'
  19. ENV DEB_BUILD_OPTIONS nocheck
  20. RUN su nginx -c 'dpkg-buildpackage -rfakeroot -uc -b'
  21. WORKDIR /home/nginx
  22. RUN dpkg -i tengine_2*_amd64.deb
  23. # 定义挂载的目录
  24. VOLUME ["/data", "/etc/nginx/sites-enabled", "/var/log/nginx"]
  25. # 让 Nginx 运行在排 Daemon 模式
  26. RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
  27. # 定义工作目录
  28. WORKDIR /etc/nginx
  29. # 添加我们的脚本,并设置权限,这会覆盖之前放在这个位置的脚本
  30. ADD run.sh /run.sh
  31. RUN chmod 755 /*.sh
  32. # 定义输出命令
  33. CMD ["/run.sh"]
  34. # 定义输出端口
  35. EXPOSE 80
  36. EXPOSE 443