-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Docker support for build and test (#6)
* Add dockerfile for Fedora rawhide * Add buildx multiplatform configuration * Add point for debian * Add Docker.md guide
- Loading branch information
1 parent
67fa6af
commit 1a4ea94
Showing
7 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,3 +65,4 @@ | |
.tools | ||
build | ||
clear.cmd | ||
build_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM --platform=$TARGETPLATFORM fedora:rawhide | ||
|
||
RUN dnf -y update | ||
|
||
RUN dnf install -y gcc clang cmake doxygen | ||
|
||
WORKDIR /usr/src |