Skip to content

Instantly share code, notes, and snippets.

@beeman
Created August 29, 2022 19:38
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save beeman/6a6448b509b2a04f1df62904ce938311 to your computer and use it in GitHub Desktop.
Save beeman/6a6448b509b2a04f1df62904ce938311 to your computer and use it in GitHub Desktop.
Docker image with solana-test-validator that works on a Apple M1
FROM debian:bullseye as base
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
WORKDIR /workspace
RUN mkdir -pv "/workspace/bin" && echo 'echo test' > '/workspace/bin/test.sh' && chmod +x '/workspace/bin/test.sh'
ENV PATH="/workspace/bin:${PATH}"
FROM base as builder
# Install os deps
RUN apt update && \
apt-get install -y build-essential clang cmake curl libudev-dev pkg-config && \
rm -rf /var/lib/apt/lists/*
# Setup rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.59.0 -y
ENV PATH="/root/.cargo/bin:${PATH}"
ARG SOLANA_VERSION=1.10.38
# Get the solana source
RUN curl https://codeload.github.com/solana-labs/solana/tar.gz/refs/tags/v$SOLANA_VERSION | tar xvz
RUN mv /workspace/solana-$SOLANA_VERSION /workspace/solana
# Build the solana-test-validator
WORKDIR /workspace/solana
RUN cargo build --bin solana-test-validator --release
RUN cp target/release/solana-test-validator /workspace/bin/
#RUN cp target/release/* /workspace/bin
FROM base as final
## Install os deps
RUN apt update && \
apt-get install -y bzip2 && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /workspace/bin/* /workspace/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment