Skip to content

Instantly share code, notes, and snippets.

@happyincent
Last active October 9, 2019 15:59
Show Gist options
  • Save happyincent/78a0fc3332eca10c7e02b9bdd105a744 to your computer and use it in GitHub Desktop.
Save happyincent/78a0fc3332eca10c7e02b9bdd105a744 to your computer and use it in GitHub Desktop.
A bake definition file example. https://github.com/docker/buildx
group "default" {
targets = ["autossh", "ffmpeg", "edge"]
}
target "autossh" {
context = "./autossh"
dockerfile = "Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7"
]
tags = ["itlabstar/autossh:ddl"]
output = ["type=registry"]
}
target "ffmpeg" {
context = "./ffmpeg"
dockerfile = "Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7"
]
tags = ["itlabstar/ffmpeg:ddl"]
output = ["type=registry"]
}
target "edge" {
context = "./edge"
dockerfile = "Dockerfile"
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7"
]
tags = ["itlabstar/edge:ddl"]
output = ["type=registry"]
}
@happyincent
Copy link
Author

Install Docker 19.03+ (test builds)

curl -fsSL https://test.docker.com -o test-docker.sh
sudo sh test-docker.sh

Install Buildx

# install qemu in static mode (without `binfmt-support`)
sudo apt install qemu qemu-user-static binfmt-support-

# install binfmt config files
git clone https://github.com/computermouth/qemu-static-conf.git
sudo mkdir -p /lib/binfmt.d
sudo cp qemu-static-conf/qemu-{aarch64,arm}-static.conf  /etc/binfmt.d
#  or enable more emulated architectures:
# sudo cp qemu-static-conf/*.conf /lib/binfmt.d/

sudo systemctl restart systemd-binfmt.service

Build

docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
docker buildx bake

@happyincent
Copy link
Author

Environment

$ cat <(echo "OS:     " `lsb_release -d | cut -f2`) <(echo "Kernel: " `uname -a | cut -d' ' -f1,3,14`) <(docker --version) <(docker-compose --version) <(docker buildx version)
OS:      Ubuntu 18.04.2 LTS
Kernel:  Linux 4.18.0-20-generic x86_64
Docker version 19.03.0-beta4, build e4666ebe81
docker-compose version 1.24.0, build 0aa5906
github.com/docker/buildx v0.2.2-6-g2b03339 2b03339235021a481300385977ca5a70a403b7c0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment