用Alpine制作httpd镜像
![](https://img-blog.csdnimg.cn/img_convert/59c21d608657bf62e9781ed0dd0a189e.png)
Alpine要换成国内的yum源
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.54.tar.gz
[root@localhost file]#
[root@localhost httpd]# vim Dockerfile
[root@localhost httpd]# cat Dockerfile
FROM alpine
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 /tmp/
ADD file/apr-util-1.6.1.tar.gz /tmp/
ADD file/httpd-${apache_version}.tar.gz /tmp/
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk update && \
apk add --no-cache -U gcc make libc-dev openssl-dev expat-dev libtool pcre-dev && \
adduser -H -S -s /sbin/nologin apache && \
cd /tmp/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 \
--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 && \
apk del gcc make && \
rm -rf /tmp/* && \
rm -rf /var/cache/*
WORKDIR /usr/local/apache
EXPOSE 80
CMD ["-D","FOREGROUND"]
ENTRYPOINT ["/usr/local/apache/bin/httpd"]
[root@localhost httpd]# podman push docker.io/aliyonghu/httpd:v0.6
[root@localhost httpd]# podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/httpd v0.6 f01c5247