forked from autonomys/subspace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-bootstrap-node.aarch64
67 lines (52 loc) · 1.93 KB
/
Dockerfile-bootstrap-node.aarch64
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
FROM ubuntu:20.04
ARG RUSTC_VERSION=nightly-2023-05-16
ARG PROFILE=production
ARG RUSTFLAGS
# Workaround for https://github.com/rust-lang/cargo/issues/10583
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
# Incremental compilation here isn't helpful
ENV CARGO_INCREMENTAL=0
WORKDIR /code
RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
protobuf-compiler \
curl \
git \
llvm \
clang \
cmake \
make && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $RUSTC_VERSION
RUN /root/.cargo/bin/rustup target add wasm32-unknown-unknown
COPY Cargo.lock /code/Cargo.lock
COPY Cargo.toml /code/Cargo.toml
COPY rust-toolchain.toml /code/rust-toolchain.toml
COPY crates /code/crates
COPY domains /code/domains
COPY orml /code/orml
COPY test /code/test
# Up until this line all Rust images in this repo should be the same to share the same layers
ENV RUSTFLAGS="${RUSTFLAGS} -C linker=aarch64-linux-gnu-gcc"
# Dependencies necessary for successful cross-compilation
RUN \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
g++-aarch64-linux-gnu \
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross
# TODO: Following package is not necessary on Ubuntu 22.04, but RocksDb compilation fails otherwise on Ubuntu 20.04
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends g++-9-multilib
RUN \
/root/.cargo/bin/cargo build \
--locked \
-Z build-std \
--profile $PROFILE \
--bin subspace-bootstrap-node \
--target aarch64-unknown-linux-gnu && \
mv target/*/*/subspace-bootstrap-node subspace-bootstrap-node && \
rm -rf target
FROM arm64v8/ubuntu:20.04
COPY --from=0 /code/subspace-bootstrap-node /subspace-bootstrap-node
USER nobody:nogroup
ENTRYPOINT ["/subspace-bootstrap-node"]