-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmake
More file actions
47 lines (39 loc) · 1.44 KB
/
Copy pathmake
File metadata and controls
47 lines (39 loc) · 1.44 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
# make - control the generation of executables and other files with rules
# A very essential build tool. Here, make is used to make make.
# https://www.gnu.org/software/make/
# base image
FROM alpine:edge as build
# install requirements
RUN apk add --no-cache gnupg gnupg-keyboxd build-base linux-headers curl jq tar xz # common base
# import gpg keys and trust them
COPY make.keys /gpgkeys
RUN gpg --import </gpgkeys && printf '%s:6:\n' \
6D4EEB02AD834703510B117680CB727A20C79BB2 \
3D2554F0A15338AB9AF1BB9D96B047156338B6D4 \
| gpg --import-ownertrust
# download and verify latest sources
WORKDIR /download
ENV MIRROR="https://ftp.halifax.rwth-aachen.de/gnu/"
RUN curl -s "$MIRROR/make/" \
| sed -n 's/.*href="make-\([0-9.]\+\)\.tar\.gz".*/\1/p' \
| sort -rV | head -1 > VERSION \
&& export VERSION=$(cat VERSION) \
&& wget "$MIRROR/make/make-$VERSION.tar.gz" \
&& wget "$MIRROR/make/make-$VERSION.tar.gz.sig" \
&& gpg --verify *.sig
# extract sources
WORKDIR /build
RUN tar xf /download/*.tar.gz --strip-components=1
# compile binaries
ENV LDFLAGS="-Wl,-z,now -Wl,-z,relro -static -s"
ENV CFLAGS="-fPIC -pie -fstack-protector-all -O2 -D_FORTIFY_SOURCE=2 -static -s"
RUN ./configure --prefix=/usr \
&& make -j$(nproc) \
&& (ldd make && exit 1 || true)
# copy sources to new stage
FROM scratch as sources
COPY --from=build /download /
COPY make /Dockerfile
# copy binaries to new stage
FROM scratch as binary
COPY --from=build /build/make /