Skip to content

nokia/corteca-toolchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base image for Corteca Toolchain

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

Clone the repository

Clone with submodules

git clone --recurse-submodules https://github.com/nokia/corteca-toolchain.git

Add submodules after cloning

In case you have previously cloned the repository without --recurse-submodules you can do:

git submodule update --init --recursive

Repo layout

├── Documentation       # Documentation
├──.VERSION             # Toolchain image version
├── Jenkinsfile         # Pipeline
├── README.md           # This file
└── Dockerfile          # Toolchain image Dockerfile

Build toolchain

Prerequisites

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.

Storage drivers

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
  }
}

Execution of different multi-architecture

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

Build a multi-platform base image

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

Test the images

We can test that our image supports multiple platforms and test each one of those

Arm v8 (64bits)

docker run --rm -it --platform linux/arm64 ghcr.io/nokia/corteca-toolchain uname -m

expected output:

aarch64

Arm v7 (32bits)

docker run --rm -it --platform linux/arm/v7 ghcr.io/nokia/corteca-toolchain uname -m

expected output:

armv7l

Amd64 (64bits)

docker run --rm -it --platform linux/amd64 ghcr.io/nokia/corteca-toolchain uname -m

expected output:

x86_64

Run a container

You can create a running container e.g. for arm64:

docker run --rm -it --platform linux/arm64 ghcr.io/nokia/corteca-toolchain