forked from malfunkt/arpfox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
87 lines (72 loc) · 2.07 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
FROM fedora:27
RUN dnf install -y \
# Commong tools
git \
tar \
flex \
byacc \
unzip \
wget \
make \
file \
python \
# Linux x86 and x64
gcc \
gcc-c++ \
libgcc.i686 \
gcc-c++.i686 \
glibc-devel \
glibc-static \
glibc-devel.i686 \
glib2-static.i686 \
libpcap.x86_64 \
libpcap.i686 \
libpcap-devel.x86_64 \
libpcap-devel.i686 \
# Windows x64
mingw32-gcc.x86_64 \
mingw64-gcc.x86_64 \
mingw32-wpcap.noarch \
mingw64-wpcap.noarch \
&& dnf clean packages
# For ARM cross compilation
RUN dnf install -y dnf-plugins-core && \
dnf copr enable -y lantw44/arm-linux-gnueabi-toolchain && \
dnf install -y arm-linux-gnueabi-{binutils,gcc,glibc} && \
dnf clean packages
RUN mkdir -p \
/opt \
/app \
/app/src/github.com/malfunkt/arpfox
ENV ANDROID_NDK_URL=https://dl.google.com/android/repository/android-ndk-r16b-linux-x86_64.zip
ENV LIBPCAP_URL=https://www.tcpdump.org/release/libpcap-1.8.1.tar.gz
ENV GO_TARBALL=https://dl.google.com/go/go1.9.4.linux-amd64.tar.gz
# Android toolchain
RUN wget --quiet -O /opt/android-ndk.zip $ANDROID_NDK_URL
RUN cd /opt && \
unzip -q android-ndk.zip && \
rm android-ndk.zip
RUN cd /opt/android-ndk-* && \
build/tools/make_standalone_toolchain.py \
--arch=arm \
--api=23 \
--install-dir=/opt/android-toolchain \
&& rm -rf /opt/android-ndk-*
# libpcap (for linux-arm and android)
RUN curl --silent -L $LIBPCAP_URL | tar -xzf - -C /opt
RUN cd /opt/libpcap-* && \
CC="/opt/android-toolchain/bin/arm-linux-androideabi-gcc" \
LD="/opt/android-toolchain/bin/arm-linux-androideabi-ld" \
./configure --prefix=/opt/android-toolchain --host=arm-linux --with-pcap=linux && \
make clean install
RUN cd /opt/libpcap-* && \
CC="/usr/bin/arm-linux-gnueabi-gcc" \
LD="/usr/bin/arm-linux-gnueabi-ld" \
./configure --prefix=/usr/arm-linux-gnueabi --host=arm-linux --with-pcap=linux && \
make clean install
# Go
RUN curl --silent -L $GO_TARBALL | tar -xzf - -C /usr/local
ENV GOROOT /usr/local/go
ENV GOPATH /app
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
WORKDIR /app/src/github.com/malfunkt/arpfox