栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Dockerfile

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Dockerfile

1、首先来个官方centos7的dockerfile,可建立最基础的centos7镜像放到自己harbor上(73M)

FROM centos:7
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == 
systemd-tmpfiles-setup.service ] || rm -f $i; done); 
rm -f /lib/systemd/system/multi-user.target.wants/*;
rm -f /etc/systemd/system/*.wants/*;
rm -f /lib/systemd/system/local-fs.target.wants/*; 
rm -f /lib/systemd/system/sockets.target.wants/*udev*; 
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; 
rm -f /lib/systemd/system/basic.target.wants/*;
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

2、根据以上镜像建立其它环境 nginx(1.20.1)+php(7.4)  (515M)

FROM registry.yoyi.tv/yoyi/centos7:latest

ENV TZ=Asia/Shanghai
ENV LANG=en_US.UTF-8

COPY CentOS-Base.repo epel-7.repo yoyi.repo /etc/yum.repos.d/

RUN  yum clean all && yum makecache  && yum -y update && 
     rpm -i https://mirrors.aliyun.com/remi/enterprise/remi-release-7.rpm --nodeps  &> /dev/null && 
     yum install -y supervisor nginx  &> /dev/null && 
     yum install -y epel-release https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm &> /dev/null && 
     yum -y install php php-bcmath php-Core php-ctype php-curl php-date php-dom php-fileinfo php-filter php-ftp php-gd php-gettext 
            php-hash php-iconv php-intl php-json php-libxml php-mbstring php-mysqli php-mysqlnd php-openssl php-pcntl php-pcre php-PDO 
            php-pdo_mysql php-pdo_sqlite php-Phar php-posix php-Reflection php-session php-shmop php-SimpleXML php-soap php-sockets php-SPL 
            php-sqlite3 php-standard php-sysvsem php-tokenizer php-xml php-xmlreader php-xmlrpc php-xmlwriter php-xsl php-zip php-zlib 
            php-fpm --enablerepo=remi-php74  &> /dev/null && 
     groupadd www && useradd -g www -s /sbin/nologin www  && 
     mkdir -p /data/nginx/conf.d /data/nginx/log /data/php-fpm/logs /home/wwwroot /home/wwwlogs && 
     sed -i 's/listen = 127.0.0.1:9000/listen = 9000/g' /etc/php-fpm.d/www.conf && sed -i 's/listen.allowed_clients = 127.0.0.1/;listen.allowed_clients = 0.0.0.0/g' /etc/php-fpm.d/www.conf && 
     yum clean all &&  rm -rf /var/cache/yum/*

COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY supervisord.conf /etc/supervisord.conf
COPY nginx.conf /etc/nginx/nginx.conf
COPY php-fpm.conf /etc/php-fpm.conf
COPY www.yoyi.com.cn.conf /etc/nginx/vhost/

VOLUME /home/

EXPOSE 80

ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/828247.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号