Dockerfile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #
  2. # Docker image to generate deterministic, verifiable builds of Anchor programs.
  3. # This must be run *after* a given ANCHOR_CLI version is published and a git tag
  4. # is released on GitHub.
  5. #
  6. FROM ubuntu:18.04
  7. ARG DEBIAN_FRONTEND=noninteractive
  8. ARG SOLANA_CLI
  9. ARG ANCHOR_CLI
  10. ENV HOME="/root"
  11. ENV PATH="${HOME}/.cargo/bin:${PATH}"
  12. ENV PATH="${HOME}/.local/share/solana/install/active_release/bin:${PATH}"
  13. ENV PATH="${HOME}/.nvm/versions/node/v17.0.1/bin:${PATH}"
  14. # Install base utilities.
  15. RUN mkdir -p /workdir && mkdir -p /tmp && \
  16. apt-get update -qq && apt-get upgrade -qq && apt-get install -qq \
  17. build-essential git curl wget jq pkg-config python3-pip \
  18. libssl-dev libudev-dev
  19. # Install rust.
  20. RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \
  21. sh rustup.sh -y && \
  22. rustup component add rustfmt clippy
  23. # Install node / npm / yarn.
  24. RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
  25. ENV NVM_DIR="${HOME}/.nvm"
  26. RUN . $NVM_DIR/nvm.sh && \
  27. nvm install node --latest-npm && \
  28. nvm use node && \
  29. nvm alias default node && \
  30. npm install -g yarn
  31. # Install Solana tools.
  32. RUN sh -c "$(curl -sSfL https://release.solana.com/${SOLANA_CLI}/install)"
  33. # Install anchor.
  34. RUN cargo install --git https://github.com/project-serum/anchor --tag ${ANCHOR_CLI} anchor-cli --locked
  35. # Build a dummy program to bootstrap the BPF SDK (doing this speeds up builds).
  36. RUN mkdir -p /tmp && cd tmp && anchor init dummy && cd dummy && anchor build
  37. WORKDIR /workdir