forked from nccgroup/thetick
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
185 lines (176 loc) · 7.33 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
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#
# The Tick, a simple backdoor for servers and embedded systems.
#
# Developed by Mario Vilas, [email protected]
# http://www.github.com/MarioVilas/thetick
#
# Originally released as open source by NCC Group Plc - http://www.nccgroup.com/
# http://www.github.com/nccgroup/thetick
#
# See the LICENSE file for further details.
#
# Dockerfile for the build environment for The Tick.
# Using the latest Ubuntu image as a base.
FROM ubuntu:latest
LABEL description="Build environment for The Tick"
# This directory will be mapped outside the container during builds.
RUN mkdir /opt/thetick; \
chmod 777 /opt/thetick
# Enable the i386 architecture to cross-compile to 32 bit Intel.
RUN dpkg --add-architecture i386; \
apt update
#----------------------------------------------------------------------------#
# Install the GNU toolchain for various architectures and versions.
#
# We cannot install gcc-multilib because it does not work well when multiple
# toolchains are installed. Therefore we install each gcc version manually.
#
# See: https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1300211
#
RUN DEBIAN_FRONTEND=noninteractive apt install -y gcc-multilib; \
DEBIAN_FRONTEND=noninteractive apt install -y build-essential libc6-dev-i386-amd64-cross \
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabi \
gcc-i686-linux-gnu \
gcc-mingw-w64-i686 \
gcc-mingw-w64-x86-64 \
gcc-mips-linux-gnu \
gcc-mips64-linux-gnuabi64
# If you want to go for the overkill, try this instead ;)
#
#RUN DEBIAN_FRONTEND=noninteractive apt install -y gcc-multilib; \
# DEBIAN_FRONTEND=noninteractive apt install -y build-essential libc6-dev-i386-amd64-cross \
# gcc-8-aarch64-linux-gnu \
# gcc-8-alpha-linux-gnu \
# gcc-8-arm-linux-gnueabi \
# gcc-8-arm-linux-gnueabihf \
# gcc-8-hppa-linux-gnu \
# gcc-8-hppa64-linux-gnu \
# gcc-8-i686-linux-gnu \
# gcc-8-m68k-linux-gnu \
# gcc-8-powerpc-linux-gnu \
# gcc-8-powerpc64-linux-gnu \
# gcc-8-powerpc64le-linux-gnu \
# gcc-8-riscv64-linux-gnu \
# gcc-8-s390x-linux-gnu \
# gcc-8-sh4-linux-gnu \
# gcc-8-sparc64-linux-gnu \
# gcc-8-x86-64-linux-gnux32 \
# gcc-9-aarch64-linux-gnu \
# gcc-9-alpha-linux-gnu \
# gcc-9-arm-linux-gnueabi \
# gcc-9-arm-linux-gnueabihf \
# gcc-9-hppa-linux-gnu \
# gcc-9-hppa64-linux-gnu \
# gcc-9-i686-linux-gnu \
# gcc-9-m68k-linux-gnu \
# gcc-9-mips-linux-gnu \
# gcc-9-mips64-linux-gnuabi64 \
# gcc-9-mips64el-linux-gnuabi64 \
# gcc-9-mipsel-linux-gnu \
# gcc-9-mipsisa32r6-linux-gnu \
# gcc-9-mipsisa32r6el-linux-gnu \
# gcc-9-mipsisa64r6-linux-gnuabi64 \
# gcc-9-mipsisa64r6el-linux-gnuabi64 \
# gcc-9-powerpc-linux-gnu \
# gcc-9-powerpc64-linux-gnu \
# gcc-9-powerpc64le-linux-gnu \
# gcc-9-riscv64-linux-gnu \
# gcc-9-s390x-linux-gnu \
# gcc-9-sh4-linux-gnu \
# gcc-9-sparc64-linux-gnu \
# gcc-9-x86-64-linux-gnu \
# gcc-9-x86-64-linux-gnux32 \
# gcc-10-aarch64-linux-gnu \
# gcc-10-alpha-linux-gnu \
# gcc-10-arm-linux-gnueabi \
# gcc-10-arm-linux-gnueabihf \
# gcc-10-hppa-linux-gnu \
# gcc-10-hppa64-linux-gnu \
# gcc-10-i686-linux-gnu \
# gcc-10-m68k-linux-gnu \
# gcc-10-mips-linux-gnu \
# gcc-10-mips64-linux-gnuabi64 \
# gcc-10-mips64el-linux-gnuabi64 \
# gcc-10-mipsel-linux-gnu \
# gcc-10-mipsisa32r6-linux-gnu \
# gcc-10-mipsisa32r6el-linux-gnu \
# gcc-10-mipsisa64r6-linux-gnuabi64 \
# gcc-10-mipsisa64r6el-linux-gnuabi64 \
# gcc-10-powerpc-linux-gnu \
# gcc-10-powerpc64-linux-gnu \
# gcc-10-powerpc64le-linux-gnu \
# gcc-10-riscv64-linux-gnu \
# gcc-10-s390x-linux-gnu \
# gcc-10-sh4-linux-gnu \
# gcc-10-sparc64-linux-gnu \
# gcc-10-x86-64-linux-gnu \
# gcc-10-x86-64-linux-gnux32 \
# gcc-aarch64-linux-gnu \
# gcc-alpha-linux-gnu \
# gcc-arm-linux-gnueabi \
# gcc-arm-linux-gnueabihf \
# gcc-hppa-linux-gnu \
# gcc-hppa64-linux-gnu \
# gcc-i686-linux-gnu \
# gcc-m68k-linux-gnu \
# gcc-mingw-w64-i686 \
# gcc-mingw-w64-x86-64 \
# gcc-mips-linux-gnu \
# gcc-mips64-linux-gnuabi64 \
# gcc-mips64el-linux-gnuabi64 \
# gcc-mipsel-linux-gnu \
# gcc-mipsisa32r6-linux-gnu \
# gcc-mipsisa32r6el-linux-gnu \
# gcc-mipsisa64r6-linux-gnuabi64 \
# gcc-mipsisa64r6el-linux-gnuabi64 \
# gcc-powerpc-linux-gnu \
# gcc-powerpc64-linux-gnu \
# gcc-powerpc64le-linux-gnu \
# gcc-riscv64-linux-gnu \
# gcc-s390x-linux-gnu \
# gcc-sh4-linux-gnu \
# gcc-sparc64-linux-gnu
#----------------------------------------------------------------------------#
# Install the Android NDK.
#
# For now we're blindly installing whatever the latest version happens to be.
# We may want some more fine grained version control in the future.
#
RUN echo "google-android-ndk-installer google-android-installers/mirror select https://dl.google.com" | debconf-set-selections; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata; \
DEBIAN_FRONTEND=noninteractive apt install -y google-android-ndk-installer; \
ln -s /usr/lib/android-ndk/toolchains/arm-linux-androideabi-*/prebuilt/linux-x86_64/bin/arm-linux-androideabi-* /usr/bin; \
ln -s /usr/lib/android-ndk/toolchains/aarch64-linux-android-*/prebuilt/linux-x86_64/bin/aarch64-linux-android-* /usr/bin; \
ln -s /usr/lib/android-ndk/toolchains/mipsel-linux-android-*/prebuilt/linux-x86_64/bin/mipsel-linux-android-* /usr/bin; \
ln -s /usr/lib/android-ndk/toolchains/mips64el-linux-android-*/prebuilt/linux-x86_64/bin/mips64el-linux-android-* /usr/bin; \
ln -s /usr/lib/android-ndk/toolchains/x86-*/prebuilt/linux-x86_64/bin/i686-linux-android-* /usr/bin; \
ln -s /usr/lib/android-ndk/toolchains/x86_64-*/prebuilt/linux-x86_64/bin/x86_64-linux-android-* /usr/bin
#----------------------------------------------------------------------------#
# Install the musl libc toolchains.
#
# These allow for more portable binaries. For more details see:
# https://stackoverflow.com/questions/57476533/why-is-statically-linking-glibc-discouraged
#
# NOTE: this will overwrite the symlinks for the "official" mingw toolchain!
# the rest of the symlinks have different names so it's fine
#
RUN apt install -y curl; \
mkdir -p /opt/musl; cd /opt/musl; \
for url in \
https://musl.cc/aarch64-linux-musl-cross.tgz \
https://musl.cc/arm-linux-musleabi-cross.tgz \
https://musl.cc/i686-linux-musl-cross.tgz \
https://musl.cc/i686-w64-mingw32-cross.tgz \
https://musl.cc/mips-linux-musl-cross.tgz \
https://musl.cc/mips64-linux-musl-cross.tgz \
https://musl.cc/x86_64-linux-musl-cross.tgz \
https://musl.cc/x86_64-w64-mingw32-cross.tgz ; \
do curl -s $url | tar -xvz; done; \
ln -sf /opt/musl/*-cross/bin/* /usr/bin
# If you want to go for the overkill, try this instead ;)
#
#RUN apt install -y curl; \
# mkdir -p /opt/musl; cd /opt/musl; \
# for url in $(curl -s musl.cc | grep cross); do curl -s $url | tar -xvz; done; \
# ln -sf /opt/musl/*-cross/bin/* /usr/bin