-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
42 lines (32 loc) · 1.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
ARG BASE=alpine:3.19
FROM $BASE as build
LABEL maintainer="Antonio Dell'Elce"
ENV BUILDDIR /app-build
ARG PROFILE=default
ARG PREFIX=/app/httpd
ENV INSTALLDIR ${PREFIX}
WORKDIR $BUILDDIR
COPY . $BUILDDIR
# Package requirements
ENV PACKAGES gcc bash wget perl perl-dev automake autoconf libtool file xz \
make libc-dev linux-headers g++ sed bison flex cmake gfortran \
awk grep
# Build and do not keep "static libraries"
RUN mkdir -p ${INSTALLDIR}/lib && ln -s ${INSTALLDIR}/lib64 ${INSTALLDIR}/lib && \
apk add --no-cache $PACKAGES && \
bash ${BUILDDIR}/docker.sh $INSTALLDIR && \
rm -f ${INSTALLDIR}/lib/*.a
# Second Stage
ARG BASE=alpine:3.19
FROM $BASE AS final
ARG PREFIX=/app/httpd
ENV INSTALLDIR ${PREFIX}
ENV PATH ${PREFIX}/bin:${PATH}
RUN mkdir -p ${INSTALLDIR} && \
apk add --no-cache libgcc
WORKDIR ${INSTALLDIR}
COPY --from=build ${INSTALLDIR} .
RUN { du -ks .; du -ks *| sort -n; } | awk ' \
BEGIN { print "Space usage in install directory: KB, % & directory name"; } \
FNR == 1 { total = $1; next; } \
$1 > 500 { printf ("%10d %03.3f%% %s\n", $1, ($1 / total) * 100, $2); } '