Since plutus-starter devcontainer on Dockerhub is outdated, and I couldn't figure out how to get it updated, I've built my own.
I hope this can help people who can't set up a Nix environment for whatever reason to be able to build Plutus dapps easily.
The Docker images are hosted on Dockerhub
Images are tagged with their generation date/time.
For example, the image tag 20231004T215021
represents 2013-10-04 21:50:21
.
We assume your plutus dapp sits under ~/Code/plutus-dapp
Install extension DevContainers.
Copy directory .devcontainer to your Haskell project's root directory. Change the docker image tag in .devcontainer/devcontainer.json as you see fit.
Bring up Command palette, and run Dev Containers: Open Folder in Container
.
Now you can build the project in VSCode's terminal using cabal build
.
If you're using other editors like VIM/Emacs, best way to go about it is to
- have an editor open to work on the project, and
- have a terminal open to work inside the container to build and test.
Start the container:
docker run -it --name plutus-dev-container -v ~/Code/plutus-dapp:/home/code/app bjing/plutus-dev-container:latest
Get inside the container:
docker exec -it plutus-dev-container bash
Since your project is mounted to /home/code/app
, we need to build from there.
Inside the container
cd ~/app
cabal build
For building or testing a project on a build pipeline, it's simpler to just run the build or test command in the container as a one-off:
# Build project
docker run -it -v ~/Code/plutus-dapp:/home/code/app bjing/plutus-dev-container:latest ./build.sh
# Test project
docker run -it -v ~/Code/plutus-dapp:/home/code/app bjing/plutus-dev-container:latest ./test.sh