Docker image for solidity development and continuous integration

Docker images come real handy when you don’t need to keep an environment running. You can just pull the docker image and have the environment ready for use. This is specially useful in continuous integration. Doesn’t matter if you use Travis, CircleCI or anything else, you can always reliably use a docker image and get an already set up reliable environment.

I was looking for a docker environment for CircleCI that had node.js and native solc binary pre-installed but I couldn’t find any. Fortunately, creating docker images by using dockerfiles is very simple and I made one for my needs easily enough. You can find the Dockerfile on GitHub and the build image is hosted on docker hub.

The image is based on Ubuntu Bionic and comes with the following tools pre installed for ease of use:

  • Node 8
  • NPM
  • Yarn
  • solc (native binary)
  • Truffle 5
  • git

Truffle 5 supports using native solc for compiling smart contracts instead of solc.js. Native solc is way faster than solc.js but is less portable. This is where docker comes in handy. Using docker images, you can have the speed of native solc and portability of solc.js.

You can use this docker image by directly pulling it from docker hub using the below command:

docker pull maxsam4/solidity-kit

The default tag is latest and it contains solidity 0.5. If you want solidity 0.4.24 then pull the tag 0.4.24 using:

docker pull maxsam4/solidity-kit:0.4.24

You may configure CircleCI to use this docker image as base container by supplying the image name in your config file:

- image: maxsam4/solidity-kit

Other CI tools can also be configured similarly. Please refer to their documentation for more information. This docker image is nothing special in its own but it will definitely come handy when you might need it.

Oh, and

Happy Holidays!

Leave a Comment

Your email address will not be published. Required fields are marked *