Skip to content

Commit 8ddb6d7

Browse files
authored
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 b0e5ea7.
1 parent fb02b61 commit 8ddb6d7

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

.github/workflows/docker_release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release Docker images
1+
name: Docker image release
22

33
on:
44
workflow_dispatch:
@@ -19,6 +19,9 @@ jobs:
1919
- name: Checkout
2020
uses: actions/checkout@v3
2121

22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v2
24+
2225
- name: Set up Docker Buildx
2326
uses: docker/setup-buildx-action@v2
2427

docker/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,21 @@ images, for example if you want to use a branch from the Haystack repo:
3636
HAYSTACK_VERSION=mybranch_or_tag BASE_IMAGE_TAG_SUFFIX=latest docker buildx bake gpu --no-cache
3737
```
3838

39+
### A note about multi-platform builds
40+
41+
Haystack images support multiple architectures, but depending on your operating system and Docker
42+
environment you might not be able to build all of them locally. If you get an error like:
43+
```
44+
multiple platforms feature is currently not supported for docker driver. Please switch to a different driver
45+
(eg. “docker buildx create --use”)
46+
```
47+
48+
you might need to override the `platform` option and limit local builds to the same architecture as
49+
your computer's. For example, on an Apple M1 you can limit the builds to ARM only by invoking `bake` like this:
50+
```sh
51+
docker buildx bake base-cpu --set "*.platform=linux/arm64"
52+
```
53+
3954
# License
4055

4156
View [license information](https://github.com/deepset-ai/haystack/blob/main/LICENSE) for

docker/docker-bake.hcl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ group "all" {
3838
targets = ["base", "base-gpu", "cpu", "gpu"]
3939
}
4040

41-
target "docker-metadata-action" {}
42-
4341
target "base-cpu" {
4442
dockerfile = "Dockerfile.base"
4543
tags = ["${IMAGE_NAME}:base-cpu-${IMAGE_TAG_SUFFIX}"]
@@ -50,6 +48,7 @@ target "base-cpu" {
5048
haystack_extras = notequal("",HAYSTACK_EXTRAS) ? "${HAYSTACK_EXTRAS}" : "[docstores,crawler,preprocessing,ocr,onnx,beir]"
5149
torch_scatter = "https://data.pyg.org/whl/torch-1.12.0+cpu.html"
5250
}
51+
platforms = ["linux/amd64", "linux/arm64"]
5352
}
5453

5554
target "base-gpu" {
@@ -62,6 +61,7 @@ target "base-gpu" {
6261
haystack_extras = notequal("",HAYSTACK_EXTRAS) ? "${HAYSTACK_EXTRAS}" : "[docstores-gpu,crawler,preprocessing,ocr,onnx-gpu,beir]"
6362
torch_scatter = "https://data.pyg.org/whl/torch-1.12.1%2Bcu113.html"
6463
}
64+
platforms = ["linux/amd64", "linux/arm64"]
6565
}
6666

6767
target "cpu" {
@@ -70,11 +70,13 @@ target "cpu" {
7070
args = {
7171
base_image_tag = "base-cpu-${BASE_IMAGE_TAG_SUFFIX}"
7272
}
73+
platforms = ["linux/amd64", "linux/arm64"]
7374
}
7475

7576
target "cpu-latest" {
7677
inherits = ["cpu"]
7778
tags = ["${IMAGE_NAME}:cpu"]
79+
platforms = ["linux/amd64", "linux/arm64"]
7880
}
7981

8082
target "gpu" {
@@ -83,12 +85,11 @@ target "gpu" {
8385
args = {
8486
base_image_tag = "base-gpu-${BASE_IMAGE_TAG_SUFFIX}"
8587
}
86-
platforms = [
87-
"linux/amd64"
88-
]
88+
platforms = ["linux/amd64", "linux/arm64"]
8989
}
9090

9191
target "gpu-latest" {
9292
inherits = ["gpu"]
9393
tags = ["${IMAGE_NAME}:gpu"]
94+
platforms = ["linux/amd64", "linux/arm64"]
9495
}

0 commit comments

Comments
 (0)