feat: add multi-platform Docker images (#3354)

* add arm platform to the build

* add a note about multi-platforms build

* test on current branch

* setup qemu on Github actions

* better naming

* Revert "test on current branch"

This reverts commit b0e5ea77b46e3e0bafd579c95e434c6a3c8ef84f.
This commit is contained in:
Massimiliano Pippi 2022-10-11 12:29:33 +02:00 committed by GitHub
parent fb02b61e90
commit 8ddb6d7821
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 6 deletions

View File

@ -1,4 +1,4 @@
name: Release Docker images
name: Docker image release
on:
workflow_dispatch:
@ -19,6 +19,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

View File

@ -36,6 +36,21 @@ images, for example if you want to use a branch from the Haystack repo:
HAYSTACK_VERSION=mybranch_or_tag BASE_IMAGE_TAG_SUFFIX=latest docker buildx bake gpu --no-cache
```
### A note about multi-platform builds
Haystack images support multiple architectures, but depending on your operating system and Docker
environment you might not be able to build all of them locally. If you get an error like:
```
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver
(eg. “docker buildx create --use”)
```
you might need to override the `platform` option and limit local builds to the same architecture as
your computer's. For example, on an Apple M1 you can limit the builds to ARM only by invoking `bake` like this:
```sh
docker buildx bake base-cpu --set "*.platform=linux/arm64"
```
# License
View [license information](https://github.com/deepset-ai/haystack/blob/main/LICENSE) for

View File

@ -38,8 +38,6 @@ group "all" {
targets = ["base", "base-gpu", "cpu", "gpu"]
}
target "docker-metadata-action" {}
target "base-cpu" {
dockerfile = "Dockerfile.base"
tags = ["${IMAGE_NAME}:base-cpu-${IMAGE_TAG_SUFFIX}"]
@ -50,6 +48,7 @@ target "base-cpu" {
haystack_extras = notequal("",HAYSTACK_EXTRAS) ? "${HAYSTACK_EXTRAS}" : "[docstores,crawler,preprocessing,ocr,onnx,beir]"
torch_scatter = "https://data.pyg.org/whl/torch-1.12.0+cpu.html"
}
platforms = ["linux/amd64", "linux/arm64"]
}
target "base-gpu" {
@ -62,6 +61,7 @@ target "base-gpu" {
haystack_extras = notequal("",HAYSTACK_EXTRAS) ? "${HAYSTACK_EXTRAS}" : "[docstores-gpu,crawler,preprocessing,ocr,onnx-gpu,beir]"
torch_scatter = "https://data.pyg.org/whl/torch-1.12.1%2Bcu113.html"
}
platforms = ["linux/amd64", "linux/arm64"]
}
target "cpu" {
@ -70,11 +70,13 @@ target "cpu" {
args = {
base_image_tag = "base-cpu-${BASE_IMAGE_TAG_SUFFIX}"
}
platforms = ["linux/amd64", "linux/arm64"]
}
target "cpu-latest" {
inherits = ["cpu"]
tags = ["${IMAGE_NAME}:cpu"]
platforms = ["linux/amd64", "linux/arm64"]
}
target "gpu" {
@ -83,12 +85,11 @@ target "gpu" {
args = {
base_image_tag = "base-gpu-${BASE_IMAGE_TAG_SUFFIX}"
}
platforms = [
"linux/amd64"
]
platforms = ["linux/amd64", "linux/arm64"]
}
target "gpu-latest" {
inherits = ["gpu"]
tags = ["${IMAGE_NAME}:gpu"]
platforms = ["linux/amd64", "linux/arm64"]
}