2021-04-06 15:15:18 -07:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
2021-03-09 05:40:09 -08:00
|
|
|
FROM ubuntu:18.04
|
|
|
|
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
2021-04-06 15:15:18 -07:00
|
|
|
ARG SOLANA_CLI
|
|
|
|
ARG ANCHOR_CLI
|
2021-03-09 05:40:09 -08:00
|
|
|
|
|
|
|
ENV HOME="/root"
|
|
|
|
ENV PATH="${HOME}/.cargo/bin:${PATH}"
|
|
|
|
ENV PATH="${HOME}/.local/share/solana/install/active_release/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
|
|
|
|
|
|
|
|
# Install rust.
|
|
|
|
RUN curl "https://sh.rustup.rs" -sfo rustup.sh && \
|
|
|
|
sh rustup.sh -y && \
|
|
|
|
rustup component add rustfmt clippy
|
|
|
|
|
|
|
|
# Install Solana tools.
|
2021-04-06 15:15:18 -07:00
|
|
|
RUN sh -c "$(curl -sSfL https://release.solana.com/${SOLANA_CLI}/install)"
|
2021-03-09 05:40:09 -08:00
|
|
|
|
|
|
|
# Install anchor.
|
2021-04-06 15:15:18 -07:00
|
|
|
RUN cargo install --git https://github.com/project-serum/anchor --tag ${ANCHOR_CLI} anchor-cli --locked
|
2021-03-09 05:40:09 -08:00
|
|
|
|
|
|
|
# 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 && anchor build
|
|
|
|
|
|
|
|
WORKDIR /workdir
|