Part of Corteca Developer Toolkit, Toolchain is a set of compilation tools that help isolate the application within the container, avoiding interaction with the host system's libraries in the creation of applications for Corteca Marketplace. This repository is hosted on https://github.com/nokia/corteca-toolchain
git clone --recurse-submodules https://github.com/nokia/corteca-toolchain.git
In case you have previously cloned the repository without --recurse-submodules
you can do:
git submodule update --init --recursive
├── Documentation # Documentation
├──.VERSION # Toolchain image version
├── Jenkinsfile # Pipeline
├── README.md # This file
└── Dockerfile # Toolchain image Dockerfile
The toolchain image is a multi-platform image, this means that a single image is created and depending on the running platform docker only pulls the layers for the specific architecture. To enable multi-platform image build we need to change the storage driver and enable docker to run images for different CPU architectures.
In order to be able to build multi-platform images you need to change the storage driver of docker. The easiest way to do it is to use the containerd image store
create file /etc/docker/daemon.json
with the following contents and restart docker daemon
{
"features": {
"containerd-snapshotter": true
}
}
Since we build the image for multiple platforms we need to support the execution of different platforms, we also need that in order to run arm64 containers on intel/amd 64bit CPUs.
For this we need enable execution of different multi-architecture containers by QEMU and binfmt_misc. For more information, see qemu-user-static.
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
Currently we build an image for amd64, arm32 and arm64.
docker buildx build \
--platform linux/amd64,linux/arm64,linux/arm/v7 \
-t ghcr.io/nokia/corteca-toolchain:$(cat .VERSION) \
-t ghcr.io/nokia/corteca-toolchain \
- < Dockerfile
We can test that our image supports multiple platforms and test each one of those
docker run --rm -it --platform linux/arm64 ghcr.io/nokia/corteca-toolchain uname -m
expected output:
aarch64
docker run --rm -it --platform linux/arm/v7 ghcr.io/nokia/corteca-toolchain uname -m
expected output:
armv7l
docker run --rm -it --platform linux/amd64 ghcr.io/nokia/corteca-toolchain uname -m
expected output:
x86_64
You can create a running container e.g. for arm64:
docker run --rm -it --platform linux/arm64 ghcr.io/nokia/corteca-toolchain