-
Notifications
You must be signed in to change notification settings - Fork 595
/
Dockerfile.build
123 lines (108 loc) · 2.84 KB
/
Dockerfile.build
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# explicitly use Debian for maximum cross-architecture compatibility
FROM debian:bullseye-slim
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gnupg \
wget \
\
gcc \
libc6-dev \
make \
\
libc6-dev-arm64-cross \
libc6-dev-armel-cross \
libc6-dev-armhf-cross \
libc6-dev-i386-cross \
libc6-dev-mips64el-cross \
libc6-dev-ppc64el-cross \
libc6-dev-riscv64-cross \
libc6-dev-s390x-cross \
\
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabi \
gcc-arm-linux-gnueabihf \
gcc-i686-linux-gnu \
gcc-mips64el-linux-gnuabi64 \
gcc-powerpc64le-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-s390x-linux-gnu \
\
arch-test \
file \
; \
rm -rf /var/lib/apt/lists/*
# https://musl.libc.org/releases.html
ENV MUSL_VERSION 1.2.4
RUN set -eux; \
wget -O musl.tgz.asc "https://musl.libc.org/releases/musl-$MUSL_VERSION.tar.gz.asc"; \
wget -O musl.tgz "https://musl.libc.org/releases/musl-$MUSL_VERSION.tar.gz"; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '836489290BB6B70F99FFDA0556BCDB593020450F'; \
gpg --batch --verify musl.tgz.asc musl.tgz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME" musl.tgz.asc; \
\
mkdir /usr/local/src/musl; \
tar --extract --file musl.tgz --directory /usr/local/src/musl --strip-components 1; \
rm musl.tgz
WORKDIR /usr/src/hello
COPY . .
RUN set -ex; \
make clean all test \
TARGET_ARCH='amd64' \
CROSS_COMPILE='x86_64-linux-gnu-' \
ARCH_TEST='amd64'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm32v5' \
CROSS_COMPILE='arm-linux-gnueabi-' \
# CFLAGS+='-march=armv5te' \
ARCH_TEST='armel'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm32v6' \
CROSS_COMPILE='arm-linux-gnueabi-' \
CFLAGS+='-march=armv6+fp' \
ARCH_TEST='armhf'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm32v7' \
CROSS_COMPILE='arm-linux-gnueabihf-' \
# CFLAGS+='-march=armv7-a+fp' \
ARCH_TEST='armhf'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm64v8' \
CROSS_COMPILE='aarch64-linux-gnu-' \
ARCH_TEST='arm64'
RUN set -ex; \
make clean all test \
TARGET_ARCH='i386' \
CROSS_COMPILE='i686-linux-gnu-' \
ARCH_TEST='i386'
RUN set -ex; \
make clean all test \
TARGET_ARCH='mips64le' \
CROSS_COMPILE='mips64el-linux-gnuabi64-' \
ARCH_TEST='mips64el'
RUN set -ex; \
make clean all test \
TARGET_ARCH='ppc64le' \
CROSS_COMPILE='powerpc64le-linux-gnu-' \
CFLAGS+='-mlong-double-64' \
ARCH_TEST='ppc64el'
RUN set -ex; \
make clean all test \
TARGET_ARCH='riscv64' \
CROSS_COMPILE='riscv64-linux-gnu-' \
ARCH_TEST='riscv64'
RUN set -ex; \
make clean all test \
TARGET_ARCH='s390x' \
CROSS_COMPILE='s390x-linux-gnu-' \
ARCH_TEST='s390x'
RUN find \( -name 'hello' -or -name 'hello.txt' \) -exec file '{}' + -exec ls -lh '{}' +
CMD ["./amd64/hello-world/hello"]