Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
build apache
FROM centos:8 AS download-httpd
RUN dnf update -y
RUN dnf install -y bzip2
ARG HTTPD_VERSION=2.4.48
ARG APR_VERSION=1.7.0
ARG APR_UTIL_VERSION=1.6.1
RUN curl -OL https://ftp.tsukuba.wide.ad.jp/software/apache/httpd/httpd-${HTTPD_VERSION}.tar.bz2
RUN curl -OL https://ftp.kddi-research.jp/infosystems/apache/apr/apr-${APR_VERSION}.tar.bz2
RUN curl -OL https://ftp.kddi-research.jp/infosystems/apache/apr/apr-util-${APR_UTIL_VERSION}.tar.gz
RUN tar xjf httpd-${HTTPD_VERSION}.tar.bz2
RUN tar xjf apr-${APR_VERSION}.tar.bz2
RUN tar xzf apr-util-${APR_UTIL_VERSION}.tar.gz
FROM centos:8
RUN dnf update -y
RUN dnf group install -y "Development Tools"
RUN dnf install -y expat-devel pcre-devel openssl-devel jansson-devel libcurl-devel
ARG HTTPD_VERSION=2.4.48
ARG APR_VERSION=1.7.0
ARG APR_UTIL_VERSION=1.6.1
COPY --from=download-httpd /httpd-${HTTPD_VERSION} /build/httpd-${HTTPD_VERSION}
COPY --from=download-httpd /apr-${APR_VERSION} /build/apr-${APR_VERSION}
COPY --from=download-httpd /apr-util-${APR_UTIL_VERSION} /build/apr-util-${APR_UTIL_VERSION}
ARG PREFIX=/opt/httpd-${HTTPD_VERSION}
WORKDIR /build/apr-${APR_VERSION}
RUN ./configure --prefix=${PREFIX}
RUN make -j4
RUN make install
WORKDIR /build/apr-util-${APR_UTIL_VERSION}
RUN ./configure --prefix=${PREFIX} --with-apr=${PREFIX}
RUN make -j4
RUN make install
WORKDIR /build/httpd-${HTTPD_VERSION}
RUN ./configure --prefix=${PREFIX} --with-apr=${PREFIX} --with-apr-util=${PREFIX}
RUN make -j4
RUN make install
WORKDIR ${PREFIX}/..
RUN tar czf ./httpd-${HTTPD_VERSION}.tar.gz httpd-${HTTPD_VERSION}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment