After collaborating with the Azure Ansible container I decided to also develop a Developer Container for those who want or need to use the Azure Blockchain Development Kit for Ethereum to create smart contracts, taking away the burden of installing Python, Truffle, Ganache and NodeJS on your machine.

Once again I collaborated with Chuck Lantz and the container definition resulted in the following two files:

1. devcontainer.json file#


This file configures the remote container with the specified extensions

 1{
 2	"name": "Azure Blockchain",
 3	"dockerFile": "Dockerfile",
 4	// Uncomment the next line if you will use a ptrace-based debugger like C++, Go, and Rust.
 5	// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
 6	// Uncomment the next line if you want to publish any ports.
 7	// "appPort": [],
 8	// Uncomment the next line if you want to add in default container specific settings.json values
 9	// "settings":  { "workbench.colorTheme": "Quiet Light" },
10	// Uncomment the next line to run commands after the container is created.
11	// "postCreateCommand": "az --version",
12	"extensions": [
13		"ms-vscode.azurecli",
14		"azblockchain.azure-blockchain"
15	]
16}

2. Dockerfile#


This is the Dockerfile with all the tooling for the Development environment.

 1#-------------------------------------------------------------------------------------------------------------
 2# Copyright (c) Microsoft Corporation. All rights reserved.
 3# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
 4#-------------------------------------------------------------------------------------------------------------
 5
 6FROM python:2.7
 7
 8# Avoid warnings by switching to noninteractive
 9ENV DEBIAN_FRONTEND=noninteractive
10
11# Configure apt and install packages
12RUN apt-get update \
13    && apt-get -y install --no-install-recommends apt-utils 2>&1 \
14    #
15    # Verify git, process tools installed
16    && apt-get -y install git procps \
17    #
18    # Install nodejs
19    && curl -sL https://deb.nodesource.com/setup_10.x | bash - \
20    && apt-get install -y nodejs \
21    #
22    # Install Truffle Suite
23    && npm i --unsafe-perm -g truffle \
24    #
25    # Install Ganache CLI
26    && npm install -g ganache-cli \
27    # 
28    # Install the Azure CLI
29    && apt-get install -y apt-transport-https curl gnupg2 lsb-release \
30    && echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/azure-cli.list \
31    && curl -sL https://packages.microsoft.com/keys/microsoft.asc | apt-key add - 2>/dev/null \
32    && apt-get update \
33    && apt-get install -y azure-cli \
34    #
35    # Clean up
36    && apt-get autoremove -y \
37    && apt-get clean -y \
38    && rm -rf /var/lib/apt/lists/*
39
40# Switch back to dialog for any ad-hoc use of apt-get
41ENV DEBIAN_FRONTEND=dialog

To learn more about this Remote Container please check here.

If you want to use Developer Conatianers with WSL 2 start here.

Hope it helps!