Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 25 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@
rm -rf /var/lib/apt/lists/*

### Setup rust
# Install rust and set the default toolchain to 1.84.1
# https://github.com/anza-xyz/agave/blob/v2.2.20/rust-toolchain.toml
ARG RUST_TOOLCHAIN_VERSION=1.84.1
# Install rust and set the default toolchain to 1.86.0
# https://github.com/anza-xyz/agave/blob/v2.3.0/rust-toolchain.toml
ARG RUST_TOOLCHAIN_VERSION=1.86.0
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --profile minimal --default-toolchain ${RUST_TOOLCHAIN_VERSION}
RUN rustup toolchain install 1.84.1
RUN rustup toolchain install 1.86.0
RUN rustc --version

### Setup go
Expand Down Expand Up @@ -236,21 +236,29 @@

WORKDIR /app/anchor

ENV RUST_TOOLCHAIN_VERSION_ANCHOR=1.84.1
ENV RUST_TOOLCHAIN_VERSION_ANCHOR=1.86.0
RUN rustup default ${RUST_TOOLCHAIN_VERSION_ANCHOR}
ARG ANCHOR_VERSION=0.31.1
ARG ANCHOR_VERSION=0.32.1

# Configure cargo for faster builds
ARG CARGO_BUILD_JOBS=default
ENV CARGO_BUILD_JOBS=$CARGO_BUILD_JOBS
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse

# Install anchor-cli with optimizations
RUN cargo install --git https://github.com/solana-foundation/anchor --tag v${ANCHOR_VERSION} anchor-cli \
# Install AVM (Anchor Version Manager) first
RUN cargo install --git https://github.com/solana-foundation/anchor --tag v${ANCHOR_VERSION} avm \
--profile release --locked

ENV PATH="/root/.avm/bin:$PATH"

# Install Anchor via AVM
# --from-source is REQUIRED for ARM64 since no prebuilt aarch64-unknown-linux-gnu binaries exist
# Available prebuilt binaries: x86_64-unknown-linux-gnu, x86_64-apple-darwin, aarch64-apple-darwin
RUN avm install ${ANCHOR_VERSION} --from-source && \
avm use ${ANCHOR_VERSION}

RUN avm --version
RUN anchor --version

# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
Expand All @@ -266,8 +274,8 @@

WORKDIR /app/solana

ENV RUST_TOOLCHAIN_VERSION_SOLANA=1.84.1
ARG SOLANA_VERSION=2.2.20
ENV RUST_TOOLCHAIN_VERSION_SOLANA=1.86.0
ARG SOLANA_VERSION=2.3.0

RUN rustup default ${RUST_TOOLCHAIN_VERSION_SOLANA}

Expand Down Expand Up @@ -485,8 +493,9 @@
# Adding in the library path to ldconfig and updating the cache
RUN echo "/root/.initia/lib" > /etc/ld.so.conf.d/initia.conf && ldconfig

# Get solana tooling
COPY --from=anchor /root/.cargo/bin/anchor /root/.cargo/bin/anchor
# Get Anchor tooling (via AVM)
COPY --from=anchor /root/.cargo/bin/avm /root/.cargo/bin/avm
COPY --from=anchor /root/.avm /root/.avm

# Copy solana cache (for platform-tools) and binaries
COPY --from=solana /root/.cache/solana /root/.cache/solana
Expand All @@ -512,6 +521,7 @@
RUN node -v
RUN pnpm --version
RUN git --version
RUN avm --version
RUN anchor --version
RUN aptos --version
RUN initiad version
Expand Down Expand Up @@ -542,11 +552,12 @@
WORKDIR /app

# Only copy Solana tooling (no EVM, Aptos, TON, etc.)
COPY --from=anchor /root/.cargo/bin/anchor /root/.cargo/bin/anchor
COPY --from=anchor /root/.cargo/bin/avm /root/.cargo/bin/avm
COPY --from=anchor /root/.avm /root/.avm
COPY --from=solana /root/.cache/solana /root/.cache/solana
COPY --from=solana /root/.solana/bin /root/.solana/bin

ENV PATH="/root/.solana/bin:$PATH"
ENV PATH="/root/.avm/bin:/root/.solana/bin:$PATH"

# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-
# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \
Expand Down