Dockerfile安装Tengine

Dockerfile安装Tengine
1、mkdir tingine_albb
cd tingine_albb
touch Dockerfile run.sh
2、编写Dockerfile
#设置继承自创建的sshd镜像
FROM sshd:dockerfile
#下面是一些创建者的基本信息
MAINTAINER waitfish from dockerpool.com([email protected])
#Let the conatiner know that there is no tty
#安装编译环境
RUN apt-get install -y build-essential debhelper make autoconf automake patch
RUN apt-get install -y dpkg-dev fakeroot pbuider gnupg dh-make libssl-dev libpcre3-dev git-core
RUN echo “Asia/Shanghai” > /etc/timezone &&
dpkg-reconfigure -f noninteractive tzdata
#创建nginx用户
RUN adduser --disabled-login --gecos “Tengine” nginx
#Tengine安装wheel脚本
WORKDIR /home/nginx
RUN su nginx -c ‘git clone https://github.com/alibaba/tengine.git’
WORKDIR /home/nginx/tengine
RUN su nginx -c ‘mv packages/debian .’
ENV DEB_BUILD_OPTIONS nocheck
RUN su nginx -c ‘dpkg-buildpackage -rfakeroot -uc -b’
WORKDIR /home/nginx
RUN dpkg -i tengine_2.0.2-1_amd64.deb
#定义挂载目录
VOLUME ["/data","/etc/nginx/sites-enabled","/var/log/nginx"]
#让Nginx运行在非Daemon模式
RUN echo “\ndaemon off;” > /etc/nginx/nginx.conf
#定义工作目录
WORKDIR /etc/nginx
#添加我们的脚本,并设置权限,这会覆盖之前放在这个位置的脚本
ADD run.sh /run.sh
RUN chmod 755 /*.sh
#定义输出命令
CMD ["/run.sh"]
#定义端口
EXPOSE 80
EXPOSE 443
3、run.sh脚本内容
#!/bin/bash
/usr/sbin/sshd &
/usr/sbun/nginx
4、创建镜像
docker build -t nginx:albb
5、测试
docker run -d -P nginx:albb
docker ps
curl 127.0.0.1:49193

你可能感兴趣的:(docker)