Use docker-bake

This commit is contained in:
Gael Goinvic committed 2026-10-07 12:59:48 +00:00
1 parent 8e9f113600
commit 031b850c15
3 files changed
+26 -11

No files matched your search

+6 -5
View File
@@ -94,11 +94,12 @@ jobs:
env:
IMAGE: ${{ steps.compute.outputs.image }}
PLAYWRIGHT_VERSION: ${{ steps.compute.outputs.playwright-version }}
run: docker build
--file tests/integration/fixtures/files/playwright/Dockerfile
--build-arg "PLAYWRIGHT_VERSION=${PLAYWRIGHT_VERSION}"
--tag "${IMAGE}"
tests/integration/fixtures/files/playwright
run: docker buildx bake
--load
--file docker-bake.hcl
--set "*.tags=${IMAGE}"
--set "*.args.PLAYWRIGHT_VERSION=${PLAYWRIGHT_VERSION}"
playwright-browser
# Docker only uploads the parts that the registry does not have already
- name: Push the image
+11 -1
View File
@@ -1,5 +1,5 @@
// Copyright 2025 New Vector Ltd
// Copyright 2025 Element Creations Ltd
// Copyright 2025-2026 Element Creations Ltd
//
// SPDX-License-Identifier: AGPL-3.0-only
@@ -11,3 +11,13 @@ target "matrix-tools" {
dockerfile = "Dockerfile"
context = "./matrix-tools"
}
// The image the browser server runs in. The integration tests drive it
// (tests/integration/fixtures/playwright.py).
// Unlike matrix-tools it does not inherit the metadata target: it is not published under
// the regular tags. Its name and tag are computed by image_reference(). The tests and CI
// pass them with --set when they build the image, together with the playwright version.
target "playwright-browser" {
dockerfile = "Dockerfile"
context = "./tests/integration/fixtures/files/playwright"
}
+9 -5
View File
@@ -33,6 +33,7 @@ except ImportError:
# locally, with the same name and tag.
IMAGE_NAME = "ghcr.io/element-hq/ess-helm/playwright-browser"
DOCKERFILE = Path(__file__).parent / "files" / "playwright" / "Dockerfile"
REPO_ROOT = Path(__file__).parent.parent.parent.parent.resolve()
# The path where the test CA certificate is mounted in the container. The start script of
# the image installs it in the browser before the browser server starts (see the Dockerfile).
@@ -70,11 +71,14 @@ def _ensure_image() -> str:
try:
docker.pull(reference)
except Exception:
docker.build(
context_path=DOCKERFILE.parent,
file=DOCKERFILE,
tags=[reference],
build_args={"PLAYWRIGHT_VERSION": package_version("playwright")},
docker.buildx.bake(
files=REPO_ROOT / "docker-bake.hcl",
targets="playwright-browser",
set={
"*.tags": reference,
"*.args.PLAYWRIGHT_VERSION": package_version("playwright"),
},
load=True,
)
return reference