forked from dellelce/mkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (36 loc) · 1.24 KB
/
Dockerfile
File metadata and controls
47 lines (36 loc) · 1.24 KB
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
43
44
45
46
47
ARG BASE=alpine:3.8
FROM $BASE as build
MAINTAINER Antonio Dell'Elce
ENV BUILDDIR /app-build
ARG PREFIX=/app/httpd
ENV INSTALLDIR ${PREFIX}
ARG PROFILE=default
# gcc, g++ C/C++ compilers
# bash needed by mkit.sh & srcget-sh
# wget builtin wget does not work for us
# perl I'll pass...
# file no magic inside
# xz xz is the "best"
# libc-dev headers
# linux-headers more headers
# sed needed by mkit.sh modules
ENV PACKAGES gcc bash wget perl perl-dev file xz make libc-dev linux-headers g++ sed
WORKDIR $BUILDDIR
COPY . $BUILDDIR
# Build and do not keep "static libraries"
RUN apk add --no-cache $PACKAGES && \
bash ${BUILDDIR}/docker.sh $INSTALLDIR && \
rm -f ${INSTALLDIR}/lib/*.a
# Second Stage
ARG BASE=alpine:latest
FROM $BASE AS final
ARG PREFIX=/app/httpd
ENV INSTALLDIR ${PREFIX}
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); } '