@@ -11,19 +11,26 @@ ENV RUSTUP_HOME=/usr/local/rustup \
11
11
# this comes from standard alpine nightly file
12
12
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
13
13
# with some changes to support our toolchain, etc
14
- RUN set -eux; \
15
- apk add --no-cache \
16
- ca-certificates \
17
- build-base;
18
-
19
- RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init"
20
- RUN chmod +x rustup-init
21
- RUN ./rustup-init -y --no-modify-path --default-toolchain 1.55.0; rm rustup-init
22
- RUN chmod -R a+w $RUSTUP_HOME $CARGO_HOME
23
-
24
- # needed for
25
- # /usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find crti.o: No such file or directory
26
- ENV LIBRARY_PATH=/usr/local/rustup/toolchains/1.55.0-x86_64-unknown-linux-musl/lib/rustlib/x86_64-unknown-linux-musl/lib:$LIBRARY_PATH
14
+ RUN set -eux \
15
+ && apk add --no-cache ca-certificates build-base
16
+
17
+ RUN wget "https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-musl/rustup-init" \
18
+ && chmod +x rustup-init \
19
+ && ./rustup-init -y --no-modify-path --profile minimal --default-toolchain 1.55.0 \
20
+ && rm rustup-init \
21
+ && chmod -R a+w $RUSTUP_HOME $CARGO_HOME
22
+
23
+ # Install C compiler for cross-compilation. This is required by
24
+ # Wasmer in https://github.com/wasmerio/wasmer/blob/2.2.1/lib/vm/build.rs.
25
+ # For newer versions this might not be needed anymore since build.rs is removed
26
+ # in https://github.com/wasmerio/wasmer/pull/2807.
27
+ #
28
+ # https://unix.stackexchange.com/questions/620205/aarch64-linux-musl-cross-has-a-broken-link-for-ld-musl-aarch64-so-1
29
+ RUN wget https://musl.cc/aarch64-linux-musl-cross.tgz \
30
+ && tar -xf aarch64-linux-musl-cross.tgz \
31
+ && mv ./aarch64-linux-musl-cross /opt \
32
+ && /opt/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc --version \
33
+ && rm aarch64-linux-musl-cross.tgz
27
34
28
35
# prepare go cache dirs
29
36
RUN mkdir -p /.cache/go-build
@@ -35,6 +42,9 @@ RUN chmod -R 777 /usr/local/cargo
35
42
## COPY BUILD SCRIPTS
36
43
WORKDIR /code
37
44
45
+ # Add musl Rust targets
46
+ RUN rustup target add aarch64-unknown-linux-musl x86_64-unknown-linux-musl
47
+
38
48
COPY guest/*.sh /opt/
39
49
RUN chmod +x /opt/*.sh
40
50
0 commit comments