Created
July 3, 2023 13:11
-
-
Save sssionggg/111937072c25cc5ec9f358e023dba63d to your computer and use it in GitHub Desktop.
Dockerfile to build 0.28.0 anchor with 1.14.18 solana.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Docker image to generate deterministic, verifiable builds of Anchor programs. | |
# This must be run *after* a given ANCHOR_CLI version is published and a git tag | |
# is released on GitHub. | |
# | |
FROM ubuntu:22.04 | |
ARG DEBIAN_FRONTEND=noninteractive | |
ARG SOLANA_CLI | |
ARG ANCHOR_CLI | |
ARG NODE_VERSION="v18.16.0" | |
ENV HOME="/root" | |
ENV PATH="${HOME}/.cargo/bin:${PATH}" | |
ENV PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}" | |
ENV PATH="${HOME}/.nvm/versions/node/${NODE_VERSION}/bin:${PATH}" | |
# Install base utilities. | |
RUN mkdir -p /workdir && mkdir -p /tmp && \ | |
apt-get update -qq && apt-get upgrade -qq && apt-get install -qq \ | |
build-essential git curl wget jq pkg-config python3-pip \ | |
libssl-dev libudev-dev | |
RUN wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb | |
RUN dpkg -i libssl1.1_1.1.1f-1ubuntu2.19_amd64.deb | |
# Install rust. | |
RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \ | |
sh rustup.sh -y && \ | |
rustup component add rustfmt clippy | |
# Install node / npm / yarn. | |
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash | |
ENV NVM_DIR="${HOME}/.nvm" | |
RUN . $NVM_DIR/nvm.sh && \ | |
nvm install ${NODE_VERSION} && \ | |
nvm use ${NODE_VERSION} && \ | |
nvm alias default node && \ | |
npm install -g yarn | |
# Install Solana tools. | |
RUN sh -c "$(curl -sSfL https://release.solana.com/${SOLANA_CLI}/install)" | |
# Install anchor. | |
RUN cargo install --git https://github.com/coral-xyz/anchor --tag ${ANCHOR_CLI} anchor-cli --locked | |
# Build a dummy program to bootstrap the BPF SDK (doing this speeds up builds). | |
RUN mkdir -p /tmp && cd tmp && anchor init dummy && cd dummy && \ | |
echo 'anchor-spl = "0.28.0"' >> ./programs/dummy/Cargo.toml && \ | |
echo 'winnow = "=0.4.1"' >> ./programs/dummy/Cargo.toml && \ | |
echo 'toml_datetime = "=0.6.1"' >> ./programs/dummy/Cargo.toml && \ | |
cargo build | |
RUN cd /tmp/dummy && \ | |
cargo update -p solana-zk-token-sdk --precise 1.14.18 && \ | |
anchor build | |
WORKDIR /workdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment