~fincham/static-binary-zoo

ref: e79e3898beb4586fb1a60be3f747649c0b38029e static-binary-zoo/Dockerfile.nmap-7.90 -rw-r--r-- 1.0 KiB
e79e3898 — Michael Fincham Spelling 5 months ago
                                                                                
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
ARG MUSL_TARGET=x86_64-linux-musl
FROM libpcap-1.10.1-${MUSL_TARGET} AS libpcap
FROM openssl-1.1.1k-${MUSL_TARGET} AS openssl
FROM musl-cross-make-${MUSL_TARGET}
ARG MUSL_TARGET

COPY --from=libpcap /output /output
COPY --from=openssl /output /output

WORKDIR /build
RUN download https://nmap.org/dist/nmap-7.92.tgz source.tar.gz 064183ea642dc4c12b1ab3b5358ce1cef7d2e7e11ffa2849f16d339f5b717117 && tar xf source.tar.gz
RUN export PATH=/build/cross/bin:$PATH && \
cd nmap-* && \
CC="${MUSL_TARGET}-gcc -static -fPIC" \
CXX="${MUSL_TARGET}-g++ -static -fPIC -static-libstdc++" \
CFLAGS="-frandom-seed=pulse -I/output/include" \
CPPFLAGS="-frandom-seed=pulse -I/output/include" \
LDFLAGS="-L/output/lib" \
./configure \
-enable-shared=no \
--enable-static=yes \
--prefix=/output \
--with-pcap=linux \
--without-ncat \
--without-nping \
--without-ndiff \
--without-nmap-update \
--without-zenmap \
--with-openssl=/output \
--host=$($MUSL_TARGET-gcc -dumpmachine) && \
make -j$(nproc) static && \
make install && \
$MUSL_TARGET-strip /output/bin/nmap

CMD bash