|
1 |
| - |
2 | 1 | ARG BASE_IMAGE=ubuntu:20.04
|
3 | 2 |
|
4 | 3 | FROM $BASE_IMAGE as builder
|
5 | 4 | SHELL ["/bin/bash", "-c"]
|
6 | 5 |
|
7 |
| -# This is being set so that no interactive components are allowed when updating. |
| 6 | +# Set noninteractive mode for apt-get |
8 | 7 | ARG DEBIAN_FRONTEND=noninteractive
|
9 | 8 |
|
10 | 9 | LABEL ai.opentensor.image.authors= "[email protected]" \
|
|
15 | 14 | ai.opentensor.image.created="${BUILD_DATE}" \
|
16 | 15 | ai.opentensor.image.documentation="https://docs.bittensor.com"
|
17 | 16 |
|
18 |
| -# show backtraces |
| 17 | +# Set up Rust environment |
19 | 18 | ENV RUST_BACKTRACE 1
|
20 |
| - |
21 |
| -# Necessary libraries for Rust execution |
22 | 19 | RUN apt-get update && \
|
23 | 20 | apt-get install -y curl build-essential protobuf-compiler clang git && \
|
24 | 21 | rm -rf /var/lib/apt/lists/*
|
25 | 22 |
|
26 |
| -# Install cargo and Rust |
27 | 23 | RUN set -o pipefail && curl https://sh.rustup.rs -sSf | sh -s -- -y
|
28 | 24 | ENV PATH="/root/.cargo/bin:${PATH}"
|
29 | 25 |
|
30 |
| -RUN mkdir -p /subtensor && \ |
31 |
| - mkdir /subtensor/scripts |
32 |
| - |
33 |
| -# Scripts |
34 |
| -COPY ./scripts/init.sh /subtensor/scripts/ |
| 26 | +RUN rustup update nightly |
| 27 | +RUN rustup update stable |
| 28 | +RUN rustup target add wasm32-unknown-unknown --toolchain nightly |
35 | 29 |
|
36 |
| -# Capture dependencies |
37 |
| -COPY Cargo.lock Cargo.toml /subtensor/ |
| 30 | +# Copy entire repository |
| 31 | +COPY . /build |
| 32 | +WORKDIR /build |
38 | 33 |
|
39 |
| -# Specs |
40 |
| -COPY ./snapshot.json /subtensor/snapshot.json |
41 |
| -COPY ./raw_spec_testfinney.json /subtensor/raw_spec_testfinney.json |
42 |
| -COPY ./raw_spec_finney.json /subtensor/raw_spec_finney.json |
| 34 | +# Build the project |
| 35 | +RUN cargo build -p node-subtensor --profile production --features runtime-benchmarks --locked |
43 | 36 |
|
44 |
| -# Copy our sources |
45 |
| -COPY ./node /subtensor/node |
46 |
| -COPY ./pallets /subtensor/pallets |
47 |
| -COPY ./runtime /subtensor/runtime |
48 |
| -COPY ./support /subtensor/support |
| 37 | +# Verify the binary was produced |
| 38 | +RUN test -e /build/target/production/node-subtensor |
49 | 39 |
|
50 |
| -# Copy our toolchain |
51 |
| -COPY rust-toolchain.toml /subtensor/ |
52 |
| -RUN /subtensor/scripts/init.sh |
53 |
| - |
54 |
| -# Cargo build |
55 |
| -WORKDIR /subtensor |
56 |
| -RUN cargo build --profile production --features runtime-benchmarks --locked |
57 | 40 | EXPOSE 30333 9933 9944
|
58 | 41 |
|
59 |
| - |
60 | 42 | FROM $BASE_IMAGE AS subtensor
|
61 | 43 |
|
62 |
| -COPY --from=builder /subtensor/snapshot.json / |
63 |
| -COPY --from=builder /subtensor/raw_spec_testfinney.json / |
64 |
| -COPY --from=builder /subtensor/raw_spec_finney.json / |
65 |
| -COPY --from=builder /subtensor/target/production/node-subtensor /usr/local/bin |
| 44 | +# Copy all chainspec files |
| 45 | +COPY --from=builder /build/*.json / |
| 46 | + |
| 47 | +# Copy final binary |
| 48 | +COPY --from=builder /build/target/production/node-subtensor /usr/local/bin |
0 commit comments