Docker LNMP之Dockerfile

1,使用centos:7制作自己的centos7:v1镜像。

FROM centos:7
LABEL maintainer="www" description="my centos"
RUN rm -rf /etc/yum.repos.d/* && \
    curl -o /etc/yum.repos.d/My-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo &>/dev/null && \
    sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/My-Base.repo && \
    yum makecache && \
    yum clean all && \
    rm -rf /var/log/yum.log && \
    rm -rf /var/cache/yum/*

该镜像仅做yum 源的修改。

 

2,使用centos7:v1镜像制作nginx镜像。

FROM centos7:v1
LABEL maintainer="www" description="PRJF NGINX"
RUN useradd  -s /sbin/nologin nginx && \
    yum -y install gcc pcre-devel gd-devel openssl-devel wget make && \
    mkdir -p /soft/server/nginx && \
    cd /soft/server/ && \
    wget http://nginx.org/download/nginx-1.16.1.tar.gz && \
    tar -zxvf nginx-1.16.1.tar.gz && \
    cd nginx-1.16.1 && \
    ./configure --prefix=/soft/server/nginx --user=nginx --group=nginx --error-log-path=/soft/server/nginx/logs/error.log --http-log-path=/soft/server/nginx/logs/access.log --with-http_ssl_module --with-http_realip_module --with-http_flv_module --with-http_image_filter_module --with-http_gzip_static_module --with-http_gunzip_module --with-http_stub_status_module --with-http_sub_module && \
    make && make install && \
    rm -rf /soft/server/nginx-1.16.1* && \
    yum clean all
VOLUME /soft/server/nginx/conf /soft/server/nginx/logs /soft/server/nginx/html
WORKDIR /soft/server/nginx/
EXPOSE 80
ENTRYPOINT ["sbin/nginx", "-g", "daemon off;"] 

3,使用centos7:v1镜像制作phpfpm镜像。

FROM centos7:v1
LABEL maintainer="www" description="PRJF PHP"
RUN yum install -y wget gcc gcc-c++ make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers && \
    mkdir -p /soft/server/php && cd /soft/ && \
    wget https://www.php.net/distributions/php-7.2.24.tar.gz && \
    tar -zxvf php-7.2.24.tar.gz && \
    cd php-7.2.24 && \
    ./configure --prefix=/soft/server/php --with-config-file-path=/soft/server/php/etc --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --without-pear  --disable-phar --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl && \
    make && make install && \
    cp php.ini-production /soft/server/php/etc/php.ini && \
	cd /soft/server/php/etc && mv php-fpm.conf.default php-fpm.conf && mv php-fpm.d/www.conf.default php-fpm.d/www.conf && \
	cd /soft && rm -rf php-7* && \
    yum clean all && \
    rm -rf /var/log/yum.log && \
    rm -rf /var/cache/yum/* 
WORKDIR /soft/server/php
EXPOSE 9000
VOLUME /soft/server/php/etc /soft/server/php/log /soft/server/nginx/html
CMD ["/soft/server/php/sbin/php-fpm", "-F"]

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值