Dockerfile文件内容
[root@localhost ~]# cd httpd/
[root@localhost httpd]# ls
Dockerfile file
[root@localhost httpd]#
[root@localhost httpd]# cd file/
[root@localhost file]# ls
apr-1.7.0.tar.gz apr-util-1.6.1.tar.gz httpd-2.4.52.tar.gz httpd-2.4.54.tar.gz
[root@localhost file]#
[root@localhost httpd]# vim Dockerfile
[root@localhost httpd]# cat Dockerfile
FROM centos
LABEL MAINTAINER='aliyonghu xianshangxian@126.com'
ENV apache_version 2.4.54
ENV PATH /usr/local/apache/bin:$PATH
ADD file/apr-1.7.0.tar.gz /usr/src/
ADD file/apr-util-1.6.1.tar.gz /usr/src/
ADD file/httpd-${apache_version}.tar.gz /usr/src/
RUN useradd -r -M -s /sbin/nologin apache && \
cd /etc/yum.repos.d/ && rm -rf * && \
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo && \
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo && \
yum clean all && yum makecache && \
yum -y install gcc gcc-c++ make openssl-devel pcre-devel expat-devel libtool && \
cd /usr/src/apr-1.7.0 && \
sed -i '/$RM "$cfgfile"/d' configure && \
./configure --prefix=/usr/local/apr && \
make && make install && \
cd ../apr-util-1.6.1 && \
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr && \
make && make install && \
cd ../httpd-${apache_version} && \
./configure --prefix=/usr/local/apache \
--enable-so \
--enable-ssl \
--enable-cgi \
--enable-rewrite \
--wit