|
1 |
| - |
2 | 1 | ARG BASE_IMAGE=ubuntu:20.04
|
3 | 2 |
|
4 |
| -FROM $BASE_IMAGE as builder |
| 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]" \
|
11 | 10 | ai.opentensor.image.vendor="Opentensor Foundation" \
|
12 | 11 | ai.opentensor.image.title="opentensor/subtensor" \
|
13 | 12 | ai.opentensor.image.description="Opentensor Subtensor Blockchain" \
|
14 |
| - ai.opentensor.image.revision="${VCS_REF}" \ |
15 |
| - ai.opentensor.image.created="${BUILD_DATE}" \ |
16 | 13 | ai.opentensor.image.documentation="https://docs.bittensor.com"
|
17 | 14 |
|
18 |
| -# show backtraces |
19 |
| -ENV RUST_BACKTRACE 1 |
20 |
| - |
21 |
| -# Necessary libraries for Rust execution |
| 15 | +# Set up Rust environment |
| 16 | +ENV RUST_BACKTRACE=1 |
22 | 17 | RUN apt-get update && \
|
23 | 18 | apt-get install -y curl build-essential protobuf-compiler clang git && \
|
24 | 19 | rm -rf /var/lib/apt/lists/*
|
25 | 20 |
|
26 |
| -# Install cargo and Rust |
27 | 21 | RUN set -o pipefail && curl https://sh.rustup.rs -sSf | sh -s -- -y
|
28 | 22 | ENV PATH="/root/.cargo/bin:${PATH}"
|
| 23 | +RUN rustup update stable |
| 24 | +RUN rustup target add wasm32-unknown-unknown --toolchain stable |
29 | 25 |
|
30 |
| -RUN mkdir -p /subtensor && \ |
31 |
| - mkdir /subtensor/scripts |
32 |
| - |
33 |
| -# Scripts |
34 |
| -COPY ./scripts/init.sh /subtensor/scripts/ |
35 |
| - |
36 |
| -# Capture dependencies |
37 |
| -COPY Cargo.lock Cargo.toml /subtensor/ |
| 26 | +# Copy entire repository |
| 27 | +COPY . /build |
| 28 | +WORKDIR /build |
38 | 29 |
|
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 |
| 30 | +# Build the project |
| 31 | +RUN cargo build -p node-subtensor --profile production --features="runtime-benchmarks metadata-hash" --locked |
43 | 32 |
|
44 |
| -# Copy our sources |
45 |
| -COPY ./node /subtensor/node |
46 |
| -COPY ./pallets /subtensor/pallets |
47 |
| -COPY ./runtime /subtensor/runtime |
48 |
| -COPY ./support /subtensor/support |
| 33 | +# Verify the binary was produced |
| 34 | +RUN test -e /build/target/production/node-subtensor |
49 | 35 |
|
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 | 36 | EXPOSE 30333 9933 9944
|
58 | 37 |
|
59 |
| - |
60 | 38 | FROM $BASE_IMAGE AS subtensor
|
61 | 39 |
|
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 |
| 40 | +# Copy all chainspec files |
| 41 | +COPY --from=builder /build/*.json / |
| 42 | + |
| 43 | +# Copy final binary |
| 44 | +COPY --from=builder /build/target/production/node-subtensor /usr/local/bin |
0 commit comments