Dockerfile用Alpine制作httpd镜像

用Alpine制作httpd镜像

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值