[root@node0 ~]# tree httpd-installa
httpd-installa
├── Dockerfile
└── packages
├── apr-1.7.0.tar.gz
├── apr-util-1.6.1.tar.gz
└── httpd-2.4.46.tar.bz2
1 directory, 4 files
[root@node0 ~]# cat httpd-installa/Dockerfile
FROM alpine:latest
LABEL MAINTAINER "fxx fxx@123.com"
ENV PATH /usr/local/apache/bin/:$PATH
ENV aprver 1.7.0
ENV aprutilver 1.6.1
ENV apachever 2.4.46
EXPOSE 80
ADD packages/apr-${aprver}.tar.gz /usr/local/src
ADD packages/apr-util-${aprutilver}.tar.gz /usr/local/src
ADD packages/httpd-${apachever}.tar.bz2 /usr/local/src
RUN adduser -SHs /sbin/nologin apache &&
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories &&
apk add --no-cache -U pcre-dev openssl openssl-dev libtool expat-dev libtool libxml2-dev gd-dev g++ make zlib-dev &&
cd /usr/local/src/apr-${aprver} && ./configure --prefix=/usr/local/apr &&
make && make install &&
cd /usr/local/src/apr-util-${aprutilver} && ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ &&
make && make install &&
cd /usr/local/src/httpd-${apachever} &&
./configure --prefix=/usr/local/apache
--sysconfdir=/etc/httpd24
--enable-so
--enable-ssl
--enable-cgi
--enable-rewrite
--with-zlib
--with-pcre
--with-apr=/usr/local/apr
--with-apr-util=/usr/local/apr-util/
--enable-modules=most
--enable-mpms-shared=all
--with-mpm=prefork &&
make && make install &&
sed -i '/#ServerName/s/#//g' /etc/httpd24/httpd.conf &&
ln -s /usr/local/apache/include/ /usr/include/httpd &&
rm -rf /usr/local/src/*
WORKDIR /usr/local/apache/
CMD /usr/local/apache/bin/apachectl -DFOREGROUND