Skip to content

Commit 9899290

Browse files
author
Roman
committed
add Dockerfile-localnet
1 parent 1ccef34 commit 9899290

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

Dockerfile-localnet

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
ARG BASE_IMAGE=ubuntu:latest
2+
3+
FROM $BASE_IMAGE AS builder
4+
SHELL ["/bin/bash", "-c"]
5+
6+
# Set noninteractive mode for apt-get
7+
ARG DEBIAN_FRONTEND=noninteractive
8+
9+
LABEL ai.opentensor.image.authors="[email protected]" \
10+
ai.opentensor.image.vendor="Opentensor Foundation" \
11+
ai.opentensor.image.title="opentensor/subtensor-localnet" \
12+
ai.opentensor.image.description="Opentensor Subtensor Blockchain" \
13+
ai.opentensor.image.documentation="https://docs.bittensor.com"
14+
15+
# Set up Rust environment
16+
ENV RUST_BACKTRACE=1
17+
18+
RUN apt-get update && \
19+
apt-get install -y curl build-essential protobuf-compiler clang git pkg-config libssl-dev llvm libudev-dev
20+
#RUN rm -rf /var/lib/apt/lists/*
21+
22+
# Copy entire repository
23+
COPY . /build
24+
WORKDIR /build
25+
26+
# Install Rust
27+
RUN set -o pipefail && curl https://sh.rustup.rs -sSf | sh -s -- -y
28+
ENV PATH="/root/.cargo/bin:${PATH}"
29+
RUN rustup toolchain install
30+
RUN rustup target add wasm32-unknown-unknown
31+
32+
## Build fast-blocks node
33+
RUN ./scripts/localnet.sh --build-only
34+
# Build non-fast-blocks
35+
#RUN ./scripts/localnet.sh False --build-only
36+
37+
# Verify the binaries was produced
38+
RUN test -e /build/target/fast-blocks/release/node-subtensor
39+
#RUN test -e /build/target/non-fast-blocks/release/node-subtensor
40+
41+
EXPOSE 30333 9933 9944 9945
42+
43+
FROM $BASE_IMAGE AS subtensor-localnet
44+
45+
# Copy binaries
46+
COPY --from=builder /build/target/fast-blocks/release/node-subtensor target/fast-blocks/release/node-subtensor
47+
RUN chmod +x target/fast-blocks/release/node-subtensor
48+
49+
#COPY --from=builder /build/target/non-fast-blocks/release/node-subtensor target/non-fast-blocks/release/node-subtensor
50+
#RUN chmod +x target/non-fast-blocks/release/node-subtensor
51+
52+
COPY --from=builder /build/snapshot.json /snapshot.json
53+
54+
COPY --from=builder /build/scripts/localnet.sh scripts/localnet.sh
55+
RUN chmod +x /scripts/localnet.sh
56+
57+
# Ubdate certificates
58+
RUN apt install ca-certificates
59+
RUN update-ca-certificates
60+
61+
# Do not build (just run)
62+
ENV BUILD_BINARY=0
63+
64+
ENTRYPOINT ["/scripts/localnet.sh"]
65+
CMD ["True"]

0 commit comments

Comments
 (0)