diff --git a/.gitignore b/.gitignore index f9005849..fe3217af 100644 --- a/.gitignore +++ b/.gitignore @@ -65,3 +65,4 @@ .tools build clear.cmd +build_* diff --git a/Docker.md b/Docker.md new file mode 100644 index 00000000..47b954ab --- /dev/null +++ b/Docker.md @@ -0,0 +1,56 @@ +# Install Docker +We need Docker with multi-platform image support. Plugin `buildx` is included by default to `docker-desktop`, and available for `docker-ce` and `moby-engine`. + +Debian: +``` +apt install moby-engine moby-buildx moby-compose moby-cli +``` +Ubuntu: +https://docs.docker.com/engine/install/ubuntu/ + +# Prepare Docker to work with multi-platform images +First time: +``` +docker buildx create --name mybuilder +docker buildx use mybuilder +``` +Each time: +``` +docker run --privileged --rm tonistiigi/binfmt --install all +``` + +# Update images for build +``` +docker buildx bake debian +docker buildx bake fedora +``` + +# Run build and test on the all available platforms +``` +docker buildx bake --progress="plain" bee2d +docker buildx bake --progress="plain" bee2f +``` + +# Run build and test on a one of available platforms +``` +docker buildx build --platform linux/amd64 --progress="plain" -f dockerfiles/bee2d.Dockerfile . +docker buildx build --platform linux/amd64 --progress="plain" -f dockerfiles/bee2f.Dockerfile . +``` + +# Run terminal on specified platform image +``` +docker run --rm -it -v .:/usr/src --platform linux/s390x btls/fedora:cdev bash +``` + +### Turn on experimental features +If option `platform` is unavailable in Docker, you need turn on experimental Docker CLI features in one of two ways. Either by setting an environment variable +``` +$ export DOCKER_CLI_EXPERIMENTAL=enabled +``` +or by turning the feature on in the config file $HOME/.docker/config.json: +``` +{ + … + "experimental" : "enabled" +} +``` \ No newline at end of file diff --git a/docker-bake.json b/docker-bake.json new file mode 100644 index 00000000..8bbebcb6 --- /dev/null +++ b/docker-bake.json @@ -0,0 +1,76 @@ +{ + "group": { + "default": { + "targets": [ + "fedora", + "debian" + ] + } + }, + "target": { + "fedora": { + "context": ".", + "dockerfile": "dockerfiles/rawhide.Dockerfile", + "tags": [ + "docker.io/btls/fedora:cdev" + ], + "platforms": [ + "linux/amd64", + "linux/arm64", + "linux/ppc64le", + "linux/s390x" + ], + "output": [ + "type=registry" + ] + }, + "debian": { + "context": ".", + "dockerfile": "dockerfiles/debian.Dockerfile", + "tags": [ + "docker.io/btls/debian:cdev" + ], + "platforms": [ + "linux/386", + "linux/amd64", + "linux/arm/v7", + "linux/arm64", + "linux/mips64le", + "linux/ppc64le", + "linux/s390x" + ], + "output": [ + "type=registry" + ] + }, + "bee2d": { + "context": ".", + "dockerfile": "dockerfiles/bee2d.Dockerfile", + "tags": [ + "bee2:debian" + ], + "platforms": [ + "linux/386", + "linux/amd64", + "linux/arm/v7", + "linux/arm64", + "linux/mips64le", + "linux/ppc64le", + "linux/s390x" + ] + }, + "bee2f": { + "context": ".", + "dockerfile": "dockerfiles/bee2f.Dockerfile", + "tags": [ + "bee2:fedora" + ], + "platforms": [ + "linux/amd64", + "linux/arm64", + "linux/ppc64le", + "linux/s390x" + ] + } + } +} \ No newline at end of file diff --git a/dockerfiles/bee2d.Dockerfile b/dockerfiles/bee2d.Dockerfile new file mode 100644 index 00000000..db596460 --- /dev/null +++ b/dockerfiles/bee2d.Dockerfile @@ -0,0 +1,23 @@ +FROM --platform=$TARGETPLATFORM btls/debian:cdev + +COPY . /usr/src + +RUN gcc --version +RUN clang --version +RUN cat /etc/os-release + +WORKDIR /usr/src +RUN rm -rf ./build_gcc; mkdir build_gcc +RUN rm -rf ./build_clang; mkdir build_clang + +WORKDIR /usr/src/build_gcc +RUN cmake .. +RUN make +RUN ctest --verbose + +WORKDIR /usr/src/build_clang +RUN cmake .. +RUN make +RUN ctest --verbose + +WORKDIR /usr/src \ No newline at end of file diff --git a/dockerfiles/bee2f.Dockerfile b/dockerfiles/bee2f.Dockerfile new file mode 100644 index 00000000..8425571b --- /dev/null +++ b/dockerfiles/bee2f.Dockerfile @@ -0,0 +1,23 @@ +FROM --platform=$TARGETPLATFORM btls/fedora:cdev + +COPY . /usr/src + +RUN gcc --version +RUN clang --version +RUN cat /etc/os-release + +WORKDIR /usr/src +RUN rm -rf ./build_gcc; mkdir build_gcc +RUN rm -rf ./build_clang; mkdir build_clang + +WORKDIR /usr/src/build_gcc +RUN cmake .. +RUN make +RUN ctest --verbose + +WORKDIR /usr/src/build_clang +RUN cmake .. +RUN make +RUN ctest --verbose + +WORKDIR /usr/src \ No newline at end of file diff --git a/dockerfiles/debian.Dockerfile b/dockerfiles/debian.Dockerfile new file mode 100644 index 00000000..688115da --- /dev/null +++ b/dockerfiles/debian.Dockerfile @@ -0,0 +1,5 @@ +FROM --platform=$TARGETPLATFORM debian:stable + +RUN apt-get update && apt-get install -y cmake git gcc doxygen clang + +WORKDIR /usr/src \ No newline at end of file diff --git a/dockerfiles/rawhide.Dockerfile b/dockerfiles/rawhide.Dockerfile new file mode 100644 index 00000000..cbc90d37 --- /dev/null +++ b/dockerfiles/rawhide.Dockerfile @@ -0,0 +1,7 @@ +FROM --platform=$TARGETPLATFORM fedora:rawhide + +RUN dnf -y update + +RUN dnf install -y gcc clang cmake doxygen + +WORKDIR /usr/src