@@ -9,28 +9,6 @@ LABEL version="${VERSION}" \
9
9
description="Use same Docker image for compiling Rust programs for Linux (musl libc) & macOS (osxcross)." \
10
10
maintainer="Jose Quintana <joseluisq.net>"
11
11
12
- # Rust stable toolchain
13
- ARG TOOLCHAIN=stable
14
-
15
- # Dependencies
16
-
17
- # OpenSSL 1.1.1 - https://www.openssl.org/source/old/1.1.1/
18
- ARG OPENSSL_VERSION=1.1.1p
19
-
20
- # zlib - http://zlib.net/
21
- ARG ZLIB_VERSION=1.2.12
22
-
23
- # libpq - https://ftp.postgresql.org/pub/source/
24
- ARG POSTGRESQL_VERSION=14.5
25
-
26
- # Mac OS X SDK version - https://github.com/joseluisq/macosx-sdks
27
- ARG OSX_SDK_VERSION=12.3
28
- ARG OSX_SDK_SUM=3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c
29
- ARG OSX_VERSION_MIN=10.14
30
-
31
- # OS X Cross - https://github.com/tpoechtrager/osxcross
32
- ARG OSX_CROSS_COMMIT=50e86ebca7d14372febd0af8cd098705049161b9
33
-
34
12
# Make sure we have basic dev tools for building C libraries. Our goal
35
13
# here is to support the musl-libc builds and Cargo builds needed for a
36
14
# large selection of the most popular crates.
@@ -45,7 +23,9 @@ RUN set -eux \
45
23
cmake \
46
24
curl \
47
25
file \
26
+ gcc-aarch64-linux-gnu \
48
27
gcc-arm-linux-gnueabihf \
28
+ g++-aarch64-linux-gnu \
49
29
git \
50
30
libbz2-dev \
51
31
libgmp-dev \
@@ -85,29 +65,19 @@ RUN set -eux \
85
65
# musl-gcc toolchain and for our Rust toolchain.
86
66
ENV PATH=/root/.cargo/bin:/usr/local/musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
87
67
88
- # Install our Rust toolchain and the `musl` target. We patch the
89
- # command-line we pass to the installer so that it won't attempt to
90
- # interact with the user or fool around with TTYs. We also set the default
91
- # `--target` to musl so that our users don't need to keep overriding it manually.
92
- RUN set -eux \
93
- && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN \
94
- && rustup target add $(uname -m)-unknown-linux-musl \
95
- && rustup target add armv7-unknown-linux-musleabihf \
96
- && rustup target add x86_64-apple-darwin \
97
- && rustup target add aarch64-apple-darwin \
98
- && true
99
- ADD docker/cargo-config.toml /root/.cargo/config
100
-
101
68
# Set up a `git credentials` helper for using GH_USER and GH_TOKEN to access
102
69
# private repositories if desired.
103
- ADD docker/git-credential-ghtoken /usr/local/bin
70
+ COPY docker/git-credential-ghtoken /usr/local/bin
104
71
RUN set -eux \
105
72
&& git config --global credential.https://github.com.helper ghtoken \
106
73
&& true
107
74
108
75
# Build a static library version of OpenSSL using musl-libc. This is needed by
109
76
# the popular Rust `hyper` crate.
110
- #
77
+
78
+ # OpenSSL 1.1.1 - https://www.openssl.org/source/old/1.1.1/
79
+ ARG OPENSSL_VERSION=1.1.1p
80
+
111
81
# We point /usr/local/musl/include/linux at some Linux kernel headers (not
112
82
# necessarily the right ones) in an effort to compile OpenSSL 1.1's "engine"
113
83
# component. It's possible that this will cause bizarre and terrible things to
@@ -139,6 +109,10 @@ RUN set -eux \
139
109
&& rm -r /tmp/* \
140
110
&& true
141
111
112
+
113
+ # zlib - http://zlib.net/
114
+ ARG ZLIB_VERSION=1.2.12
115
+
142
116
RUN set -eux \
143
117
&& echo "Building zlib ${ZLIB_VERSION}..." \
144
118
&& cd /tmp \
@@ -151,6 +125,10 @@ RUN set -eux \
151
125
&& rm -r /tmp/* \
152
126
&& true
153
127
128
+
129
+ # libpq - https://ftp.postgresql.org/pub/source/
130
+ ARG POSTGRESQL_VERSION=14.5
131
+
154
132
RUN set -eux \
155
133
&& echo "Building libpq ${POSTGRESQL_VERSION}..." \
156
134
&& cd /tmp \
@@ -185,9 +163,16 @@ ENV X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_DIR=/usr/local/musl/ \
185
163
# everybody needing to build them manually.)
186
164
187
165
166
+ # Mac OS X SDK version - https://github.com/joseluisq/macosx-sdks
167
+ ARG OSX_SDK_VERSION=12.3
168
+ ARG OSX_SDK_SUM=3abd261ceb483c44295a6623fdffe5d44fc4ac2c872526576ec5ab5ad0f6e26c
169
+ ARG OSX_VERSION_MIN=10.14
170
+
171
+ # OS X Cross - https://github.com/tpoechtrager/osxcross
172
+ ARG OSX_CROSS_COMMIT=50e86ebca7d14372febd0af8cd098705049161b9
173
+
188
174
# Install OS X Cross
189
175
# A Mac OS X cross toolchain for Linux, FreeBSD, OpenBSD and Android
190
-
191
176
RUN set -eux \
192
177
&& echo "Cloning osxcross..." \
193
178
&& git clone https://github.com/tpoechtrager/osxcross.git /usr/local/osxcross \
@@ -221,8 +206,28 @@ RUN set -eux \
221
206
&& echo "compiler-rt installed and working successfully!" \
222
207
&& true
223
208
209
+
210
+ # Rust stable toolchain
211
+ ARG TOOLCHAIN=stable
212
+
213
+ # Install our Rust toolchain and the `musl` target. We patch the
214
+ # command-line we pass to the installer so that it won't attempt to
215
+ # interact with the user or fool around with TTYs. We also set the default
216
+ # `--target` to musl so that our users don't need to keep overriding it manually.
217
+ RUN set -eux \
218
+ && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN \
219
+ && rustup target add \
220
+ aarch64-apple-darwin \
221
+ aarch64-unknown-linux-gnu \
222
+ aarch64-unknown-linux-musl \
223
+ armv7-unknown-linux-musleabihf \
224
+ x86_64-apple-darwin \
225
+ x86_64-unknown-linux-musl \
226
+ && true
227
+ COPY docker/cargo-config.toml /root/.cargo/config
228
+
224
229
RUN set -eux \
225
- && echo "Removing osxcross temp files..." \
230
+ && echo "Removing temp files..." \
226
231
&& rm -rf *~ taballs *.tar.xz \
227
232
&& rm -rf /tmp/* \
228
233
&& true
0 commit comments