Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 16 additions & 10 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# is released on GitHub.
#

FROM rust:1.75
# amd64: Solana 1.17 has no prebuilt aarch64-linux binaries.
FROM --platform=linux/amd64 rust:1.75

ARG DEBIAN_FRONTEND=noninteractive

ARG SOLANA_CLI="1.17.16"
# Keep in sync with Anchor.toml.
ARG SOLANA_CLI="1.17.34"
ARG ANCHOR_CLI="0.29.0"
ARG NODE_VERSION="v18.16.0"
ARG NODE_VERSION="v20.18.0"

ENV HOME="/root"
ENV PATH="${HOME}/.cargo/bin:${PATH}"
Expand Down Expand Up @@ -41,17 +43,21 @@ RUN . $NVM_DIR/nvm.sh && \
npm install -g yarn

# Install Solana tools.
RUN sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI}/install)"
RUN curl -sSfL "https://release.anza.xyz/v${SOLANA_CLI}/install" -o /tmp/solana-install.sh && \
sh /tmp/solana-install.sh && \
rm /tmp/solana-install.sh

# Install anchor.
RUN cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
RUN avm install ${ANCHOR_CLI} && avm use ${ANCHOR_CLI}
RUN cargo install --git https://github.com/coral-xyz/anchor --tag v${ANCHOR_CLI} anchor-cli --locked

# set up keypair
RUN solana-keygen new --no-bip39-passphrase
RUN solana-keygen new --no-bip39-passphrase && \
solana config set --url localhost

# zsh
RUN apt-get update -qq && apt-get install -qq zsh && \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended && \
chsh -s /usr/bin/zsh root

WORKDIR /workdir
#be sure to add `/root/.avm/bin` to your PATH to be able to run the installed binaries

# install dependencies
RUN yarn
28 changes: 27 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
{
"build": { "dockerfile": "Dockerfile" },
"name": "MetaDAO Programs",
"build": {
"dockerfile": "Dockerfile",
"platform": "linux/amd64"
},
"workspaceMount": "source=${localWorkspaceFolder},target=/workdir,type=bind,consistency=cached",
"workspaceFolder": "/workdir",
"remoteUser": "root",
"mounts": [
"source=metadao-target,target=/workdir/target,type=volume,consistency=delegated"
],
"customizations": {
"vscode": {
"extensions": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml"
]
}
},
"forwardPorts": [8899, 8900],
"portsAttributes": {
"8899": { "label": "Solana Test Validator" },
"8900": { "label": "Solana Test Validator RPC" }
},
"containerEnv": {
"ANCHOR_WALLET": "/root/.config/solana/id.json"
}
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ Before you can build and test the programs, you'll need to install the following
- **Node.js**: 16.x or higher (tested with v23.x)
- **Yarn**: 1.22.22 or compatible

### Dev Container

The repository ships a dev container with all of the above preinstalled. With Docker running, open the repo in VS Code / Zed / Cursor and choose "Reopen in Container", then:

```bash
yarn install
anchor build
```

Note: the image is pinned to `linux/amd64`, so builds on Apple Silicon run under emulation and are slower than a native setup.

### MacOS Setup

#### 1. Clone the Repository
Expand Down