Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web3 Dev Environment (Docker)

Web3 Dev Environment header

One container with everything you need for Web3 dev: Solidity, Go, Rust, Solana. Works on Windows, macOS, Linux. No local installs, no WSL headaches.

Tool Version
Foundry (forge, cast, anvil) latest stable
Go 1.23.4
Rust stable
Solana CLI 1.18.26
Anchor 0.30.1
Node 20.x

Versions are pinned via ARG in the Dockerfile so you can bump any of them without touching the rest of the file.

Getting started

You need Docker Desktop (Windows/macOS) or Docker Engine (Linux). That's it.

Copy the files into your project root, then:

cp .env.example .env
# fill in your keys
make up       # builds the image on first run (~5-10 min), then starts
make shell    # get a shell inside the container

From there, forge, go, rustc, anchor, solana are all on PATH.

Never commit .env. Use a dedicated dev wallet for PRIVATE_KEY, not your main one.

Daily commands

make up       # start
make shell    # open a shell
make down     # stop
make logs     # follow logs
make rebuild  # full rebuild after Dockerfile changes
make clean    # nuclear option, see below

Cursor / VS Code

Install the Dev Containers extension. Open your project, then Ctrl+Shift+P > "Dev Containers: Reopen in Container". Your editor runs inside the container with full IntelliSense.

Upgrading a tool

docker compose build --build-arg GO_VERSION=1.23.5
docker compose build --build-arg ANCHOR_VERSION=0.31.0

A few non-obvious choices

Node comes from NodeSource, not apt. Ubuntu 22.04's apt ships Node 12. Anchor tests need Node 18+.

Anchor is installed from crates.io, not --git. Building from the GitHub source takes 30-40 minutes per image build. The published crate takes 2-3 minutes. There's no real downside unless you need an unreleased commit.

Three separate Cargo volumes. ~/.cargo/registry for published crates, ~/.cargo/git for git-sourced deps (some Anchor deps still come from GitHub), and ~/.foundry for Forge binaries. Skip any of these and you're re-downloading on every rebuild.

restart: unless-stopped in docker-compose. The container comes back up after a reboot without you having to remember to run make up.

Cleaning up

make clean

This removes all Docker containers, images, volumes and build cache on your machine, not just this project's. Don't run it if you have unrelated Docker stuff you care about.

Quick starts

Foundry fork test:

forge init my-project && cd my-project
forge test --fork-url $ALCHEMY_MAINNET_RPC --fork-block-number 19000000

Anchor program:

anchor init my-program && cd my-program
anchor build && anchor test
solana config set --url devnet && solana airdrop 2 && anchor deploy

go-ethereum indexer:

mkdir go-indexer && cd go-indexer
go mod init github.com/yourname/go-indexer
go get github.com/ethereum/go-ethereum

MIT license.

About

Docker environment for Web3 dev - Foundry, Go, Rust, Solana and Anchor in one container. Works on Windows, macOS, Linux.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages