-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile.arm
87 lines (76 loc) · 2.9 KB
/
Dockerfile.arm
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 ubuntu:22.04 as base
ENV DEBIAN_FRONTEND=noninteractive
# base applications
RUN apt-get update && apt-get install -y tzdata wget make git flex bison
# all our cross compile stuff
RUN apt-get install -y \
golang-1.18-go \
gcc-11 gcc-11-base gcc-11-cross-base \
binutils-arm-linux-gnueabihf \
binutils-arm-linux-gnueabi \
binutils-aarch64-linux-gnu \
linux-libc-dev-armhf-cross \
linux-libc-dev-armel-cross \
linux-libc-dev-arm64-cross \
gccgo-11-arm-linux-gnueabihf \
gccgo-11-arm-linux-gnueabi \
gccgo-11-aarch64-linux-gnu \
gcc-11-arm-linux-gnueabihf \
gcc-11-arm-linux-gnueabi \
gcc-11-aarch64-linux-gnu \
libgo21-armhf-cross \
libgo21-armel-cross \
libgo21-arm64-cross \
libgcc-11-dev-armhf-cross \
libgcc-11-dev-armel-cross \
libgcc-11-dev-arm64-cross \
libc6-armhf-cross \
libc6-armel-cross \
libc6-arm64-cross \
libc6-dev-armhf-cross \
libc6-dev-armel-cross \
libc6-dev-arm64-cross
RUN mkdir -p /buildhf/bin && cd /buildhf/bin && \
ln -s /usr/bin/arm-linux-gnueabihf-gccgo-11 gccgo && \
ln -s /usr/bin/arm-linux-gnueabihf-gcc-ar-11 ar && \
ln -s /usr/bin/arm-linux-gnueabihf-gcc-ranlib-11 ranlib && \
ln -s /usr/bin/arm-linux-gnueabihf-gcc-11 gcc
RUN mkdir -p /build/bin && cd /build/bin && \
ln -s /usr/bin/arm-linux-gnueabi-gccgo-11 gccgo && \
ln -s /usr/bin/arm-linux-gnueabi-gcc-ar-11 ar && \
ln -s /usr/bin/arm-linux-gnueabi-gcc-ranlib-11 ranlib && \
ln -s /usr/bin/arm-linux-gnueabi-gcc-11 gcc
RUN mkdir -p /build64/bin && cd /build64/bin && \
ln -s /usr/bin/aarch64-linux-gnu-gccgo-11 gccgo && \
ln -s /usr/bin/aarch64-linux-gnu-gcc-ar-11 ar && \
ln -s /usr/bin/aarch64-linux-gnu-gcc-ranlib-11 ranlib && \
ln -s /usr/bin/aarch64-linux-gnu-gcc-11 gcc
# build libpcap
FROM base as libpcap
ENV LIBPCAP_VERSION=1.10.3
WORKDIR /build
RUN wget -qO - https://www.tcpdump.org/release/libpcap-${LIBPCAP_VERSION}.tar.gz | tar zxf -
WORKDIR /build/libpcap-${LIBPCAP_VERSION}
# hardware float
RUN CC=/buildhf/bin/gcc BUILD_CC=gcc AR=/buildhf/bin/ar RANLIB=/buildhf/bin/ranlib \
./configure --build i686-pc-linux-gnu \
--host arm-linux-gnueabihf --prefix=/usr/arm-linux-gnueabihf && \
make install
# software float
RUN make clean && \
CC=/build/bin/gcc BUILD_CC=gcc AR=/build/bin/ar RANLIB=/build/bin/ranlib \
./configure --build i686-pc-linux-gnu \
--host arm-linux-gnueabi --prefix=/usr/arm-linux-gnueabi && \
make install
# arm64
RUN make clean && \
CC=/build64/bin/gcc BUILD_CC=gcc AR=/build64/bin/ar RANLIB=/build64/bin/ranlib \
./configure --build i686-pc-linux-gnu \
--host aarch64-linux-gnu --prefix=/usr/aarch64-linux-gnu && \
make install
# build our app
FROM libpcap
WORKDIR /build/udp-proxy-2020
ENV GOROOT=/usr/lib/go-1.18
ENV PATH=/build/bin:${GOROOT}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENTRYPOINT make .linux-arm