diff mbox series

[for-4.19,1/4] CI: Formalise the use of heredocs

Message ID 20240703142002.1662874-2-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series CI: Fixes, part 1 | expand

Commit Message

Andrew Cooper July 3, 2024, 2:19 p.m. UTC
Commit b5739330d7f4 introduced the use of heredocs in the jessie/stretch
dockerfiles.

It turns out this was introduced by BuildKit in 2018 along with a
standardisation of Dockerfile syntax, and has subsequently been adopted by the
docker community.

Annotate all dockerfiles with a statement of the syntax in use, and extend
README.md details including how to activate BuildKit when it's available but
off by default.

This allows the containers to be rebuilt following commit a0e29b316363 ("CI:
Drop glibc-i386 from the build containers").

Fixes: b5739330d7f4 ("automation: fix jessie/stretch images to use archive.debian.org apt repos")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Doug Goldstein <cardoe@cardoe.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 automation/build/README.md                             | 10 +++++++++-
 automation/build/alpine/3.18-arm64v8.dockerfile        |  1 +
 automation/build/alpine/3.18.dockerfile                |  1 +
 automation/build/archlinux/current-riscv64.dockerfile  |  1 +
 automation/build/archlinux/current.dockerfile          |  1 +
 automation/build/centos/7.dockerfile                   |  1 +
 .../build/debian/bookworm-arm64v8-arm32-gcc.dockerfile |  1 +
 automation/build/debian/bookworm-arm64v8.dockerfile    |  1 +
 automation/build/debian/bookworm-cppcheck.dockerfile   |  1 +
 automation/build/debian/bookworm-i386.dockerfile       |  1 +
 automation/build/debian/bookworm.dockerfile            |  1 +
 automation/build/debian/bullseye-ppc64le.dockerfile    |  1 +
 automation/build/debian/buster-gcc-ibt.dockerfile      |  1 +
 automation/build/debian/jessie-i386.dockerfile         |  1 +
 automation/build/debian/jessie.dockerfile              |  1 +
 automation/build/debian/stretch-i386.dockerfile        |  1 +
 automation/build/debian/stretch.dockerfile             |  1 +
 automation/build/fedora/29.dockerfile                  |  1 +
 automation/build/suse/opensuse-leap.dockerfile         |  1 +
 automation/build/suse/opensuse-tumbleweed.dockerfile   |  1 +
 automation/build/ubuntu/bionic.dockerfile              |  1 +
 automation/build/ubuntu/focal.dockerfile               |  1 +
 automation/build/ubuntu/trusty.dockerfile              |  1 +
 automation/build/ubuntu/xenial-xilinx.dockerfile       |  1 +
 automation/build/ubuntu/xenial.dockerfile              |  1 +
 automation/build/yocto/yocto.dockerfile.in             |  2 ++
 .../tests-artifacts/alpine/3.18-arm64v8.dockerfile     |  1 +
 automation/tests-artifacts/alpine/3.18.dockerfile      |  1 +
 .../tests-artifacts/kernel/5.19-arm64v8.dockerfile     |  1 +
 automation/tests-artifacts/kernel/6.1.19.dockerfile    |  1 +
 .../qemu-system-aarch64/6.0.0-arm64v8.dockerfile       |  1 +
 .../qemu-system-ppc64/8.1.0-ppc64.dockerfile           |  1 +
 32 files changed, 41 insertions(+), 1 deletion(-)

Comments

Roger Pau Monné July 3, 2024, 2:34 p.m. UTC | #1
On Wed, Jul 03, 2024 at 03:19:59PM +0100, Andrew Cooper wrote:
> Commit b5739330d7f4 introduced the use of heredocs in the jessie/stretch
> dockerfiles.
> 
> It turns out this was introduced by BuildKit in 2018 along with a
> standardisation of Dockerfile syntax, and has subsequently been adopted by the
> docker community.
> 
> Annotate all dockerfiles with a statement of the syntax in use, and extend
> README.md details including how to activate BuildKit when it's available but
> off by default.
> 
> This allows the containers to be rebuilt following commit a0e29b316363 ("CI:
> Drop glibc-i386 from the build containers").
> 
> Fixes: b5739330d7f4 ("automation: fix jessie/stretch images to use archive.debian.org apt repos")
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

> ---
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Doug Goldstein <cardoe@cardoe.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
>  automation/build/README.md                             | 10 +++++++++-
>  automation/build/alpine/3.18-arm64v8.dockerfile        |  1 +
>  automation/build/alpine/3.18.dockerfile                |  1 +
>  automation/build/archlinux/current-riscv64.dockerfile  |  1 +
>  automation/build/archlinux/current.dockerfile          |  1 +
>  automation/build/centos/7.dockerfile                   |  1 +
>  .../build/debian/bookworm-arm64v8-arm32-gcc.dockerfile |  1 +
>  automation/build/debian/bookworm-arm64v8.dockerfile    |  1 +
>  automation/build/debian/bookworm-cppcheck.dockerfile   |  1 +
>  automation/build/debian/bookworm-i386.dockerfile       |  1 +
>  automation/build/debian/bookworm.dockerfile            |  1 +
>  automation/build/debian/bullseye-ppc64le.dockerfile    |  1 +
>  automation/build/debian/buster-gcc-ibt.dockerfile      |  1 +
>  automation/build/debian/jessie-i386.dockerfile         |  1 +
>  automation/build/debian/jessie.dockerfile              |  1 +
>  automation/build/debian/stretch-i386.dockerfile        |  1 +
>  automation/build/debian/stretch.dockerfile             |  1 +
>  automation/build/fedora/29.dockerfile                  |  1 +
>  automation/build/suse/opensuse-leap.dockerfile         |  1 +
>  automation/build/suse/opensuse-tumbleweed.dockerfile   |  1 +
>  automation/build/ubuntu/bionic.dockerfile              |  1 +
>  automation/build/ubuntu/focal.dockerfile               |  1 +
>  automation/build/ubuntu/trusty.dockerfile              |  1 +
>  automation/build/ubuntu/xenial-xilinx.dockerfile       |  1 +
>  automation/build/ubuntu/xenial.dockerfile              |  1 +
>  automation/build/yocto/yocto.dockerfile.in             |  2 ++
>  .../tests-artifacts/alpine/3.18-arm64v8.dockerfile     |  1 +
>  automation/tests-artifacts/alpine/3.18.dockerfile      |  1 +
>  .../tests-artifacts/kernel/5.19-arm64v8.dockerfile     |  1 +
>  automation/tests-artifacts/kernel/6.1.19.dockerfile    |  1 +
>  .../qemu-system-aarch64/6.0.0-arm64v8.dockerfile       |  1 +
>  .../qemu-system-ppc64/8.1.0-ppc64.dockerfile           |  1 +
>  32 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/automation/build/README.md b/automation/build/README.md
> index 1c040533fdd8..12a2b4af1807 100644
> --- a/automation/build/README.md
> +++ b/automation/build/README.md
> @@ -81,7 +81,14 @@ Building a container
>  
>  There is a makefile to make this process easier. You should be
>  able to run `make DISTRO/VERSION` to have Docker build the container
> -for you. If you define the `PUSH` environment variable when running the
> +for you.
> +
> +Xen's dockerfiles use heredocs, which depend on the standardised dockerfile
> +syntax introduced by [BuiltKit].  This should work by default starting with
> +docker 23.0, or podman/buildah v1.33.  For older versions of docker, it can be
> +activated with `DOCKER_BUILDKIT=1` in the environment.
> +
> +If you define the `PUSH` environment variable when running the
>  former `make` command, it will push the container to the [registry] if
>  you have access to do so and have your Docker logged into the registry.
>  
> @@ -101,6 +108,7 @@ env CONTAINER_NO_PULL=1 \
>  make -C automation/build suse/opensuse-tumbleweed PUSH=1
>  ```
>  
> +[BuildKit]: https://docs.docker.com/build/buildkit/
>  [registry]: https://gitlab.com/xen-project/xen/container_registry
>  [registry help]: https://gitlab.com/help/user/project/container_registry
>  
> diff --git a/automation/build/alpine/3.18-arm64v8.dockerfile b/automation/build/alpine/3.18-arm64v8.dockerfile
> index 91e90220240f..19fe46f8418f 100644
> --- a/automation/build/alpine/3.18-arm64v8.dockerfile
> +++ b/automation/build/alpine/3.18-arm64v8.dockerfile
> @@ -1,3 +1,4 @@
> +# syntax=docker/dockerfile:1

Will this fail to parse if not using BuildKit?

Thanks, Roger.
Andrew Cooper July 3, 2024, 2:38 p.m. UTC | #2
On 03/07/2024 3:34 pm, Roger Pau Monné wrote:
> On Wed, Jul 03, 2024 at 03:19:59PM +0100, Andrew Cooper wrote:
>> Commit b5739330d7f4 introduced the use of heredocs in the jessie/stretch
>> dockerfiles.
>>
>> It turns out this was introduced by BuildKit in 2018 along with a
>> standardisation of Dockerfile syntax, and has subsequently been adopted by the
>> docker community.
>>
>> Annotate all dockerfiles with a statement of the syntax in use, and extend
>> README.md details including how to activate BuildKit when it's available but
>> off by default.
>>
>> This allows the containers to be rebuilt following commit a0e29b316363 ("CI:
>> Drop glibc-i386 from the build containers").
>>
>> Fixes: b5739330d7f4 ("automation: fix jessie/stretch images to use archive.debian.org apt repos")
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>

Thanks.

>
>> ---
>> CC: Anthony PERARD <anthony.perard@vates.tech>
>> CC: Stefano Stabellini <sstabellini@kernel.org>
>> CC: Doug Goldstein <cardoe@cardoe.com>
>> CC: Roger Pau Monné <roger.pau@citrix.com>
>> CC: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> ---
>>  automation/build/README.md                             | 10 +++++++++-
>>  automation/build/alpine/3.18-arm64v8.dockerfile        |  1 +
>>  automation/build/alpine/3.18.dockerfile                |  1 +
>>  automation/build/archlinux/current-riscv64.dockerfile  |  1 +
>>  automation/build/archlinux/current.dockerfile          |  1 +
>>  automation/build/centos/7.dockerfile                   |  1 +
>>  .../build/debian/bookworm-arm64v8-arm32-gcc.dockerfile |  1 +
>>  automation/build/debian/bookworm-arm64v8.dockerfile    |  1 +
>>  automation/build/debian/bookworm-cppcheck.dockerfile   |  1 +
>>  automation/build/debian/bookworm-i386.dockerfile       |  1 +
>>  automation/build/debian/bookworm.dockerfile            |  1 +
>>  automation/build/debian/bullseye-ppc64le.dockerfile    |  1 +
>>  automation/build/debian/buster-gcc-ibt.dockerfile      |  1 +
>>  automation/build/debian/jessie-i386.dockerfile         |  1 +
>>  automation/build/debian/jessie.dockerfile              |  1 +
>>  automation/build/debian/stretch-i386.dockerfile        |  1 +
>>  automation/build/debian/stretch.dockerfile             |  1 +
>>  automation/build/fedora/29.dockerfile                  |  1 +
>>  automation/build/suse/opensuse-leap.dockerfile         |  1 +
>>  automation/build/suse/opensuse-tumbleweed.dockerfile   |  1 +
>>  automation/build/ubuntu/bionic.dockerfile              |  1 +
>>  automation/build/ubuntu/focal.dockerfile               |  1 +
>>  automation/build/ubuntu/trusty.dockerfile              |  1 +
>>  automation/build/ubuntu/xenial-xilinx.dockerfile       |  1 +
>>  automation/build/ubuntu/xenial.dockerfile              |  1 +
>>  automation/build/yocto/yocto.dockerfile.in             |  2 ++
>>  .../tests-artifacts/alpine/3.18-arm64v8.dockerfile     |  1 +
>>  automation/tests-artifacts/alpine/3.18.dockerfile      |  1 +
>>  .../tests-artifacts/kernel/5.19-arm64v8.dockerfile     |  1 +
>>  automation/tests-artifacts/kernel/6.1.19.dockerfile    |  1 +
>>  .../qemu-system-aarch64/6.0.0-arm64v8.dockerfile       |  1 +
>>  .../qemu-system-ppc64/8.1.0-ppc64.dockerfile           |  1 +
>>  32 files changed, 41 insertions(+), 1 deletion(-)
>>
>> diff --git a/automation/build/README.md b/automation/build/README.md
>> index 1c040533fdd8..12a2b4af1807 100644
>> --- a/automation/build/README.md
>> +++ b/automation/build/README.md
>> @@ -81,7 +81,14 @@ Building a container
>>  
>>  There is a makefile to make this process easier. You should be
>>  able to run `make DISTRO/VERSION` to have Docker build the container
>> -for you. If you define the `PUSH` environment variable when running the
>> +for you.
>> +
>> +Xen's dockerfiles use heredocs, which depend on the standardised dockerfile
>> +syntax introduced by [BuiltKit].  This should work by default starting with
>> +docker 23.0, or podman/buildah v1.33.  For older versions of docker, it can be
>> +activated with `DOCKER_BUILDKIT=1` in the environment.
>> +
>> +If you define the `PUSH` environment variable when running the
>>  former `make` command, it will push the container to the [registry] if
>>  you have access to do so and have your Docker logged into the registry.
>>  
>> @@ -101,6 +108,7 @@ env CONTAINER_NO_PULL=1 \
>>  make -C automation/build suse/opensuse-tumbleweed PUSH=1
>>  ```
>>  
>> +[BuildKit]: https://docs.docker.com/build/buildkit/
>>  [registry]: https://gitlab.com/xen-project/xen/container_registry
>>  [registry help]: https://gitlab.com/help/user/project/container_registry
>>  
>> diff --git a/automation/build/alpine/3.18-arm64v8.dockerfile b/automation/build/alpine/3.18-arm64v8.dockerfile
>> index 91e90220240f..19fe46f8418f 100644
>> --- a/automation/build/alpine/3.18-arm64v8.dockerfile
>> +++ b/automation/build/alpine/3.18-arm64v8.dockerfile
>> @@ -1,3 +1,4 @@
>> +# syntax=docker/dockerfile:1
> Will this fail to parse if not using BuildKit?

No.  To "the legacy builder" (the pre-BuildKit thing), it's just a comment.

But to anything semi recent, it defines the version of the dockerfile
syntax we intend to use, and in particular will prevent you from
accidentally using newer syntax in an older dockerfile.

~Andrew
diff mbox series

Patch

diff --git a/automation/build/README.md b/automation/build/README.md
index 1c040533fdd8..12a2b4af1807 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -81,7 +81,14 @@  Building a container
 
 There is a makefile to make this process easier. You should be
 able to run `make DISTRO/VERSION` to have Docker build the container
-for you. If you define the `PUSH` environment variable when running the
+for you.
+
+Xen's dockerfiles use heredocs, which depend on the standardised dockerfile
+syntax introduced by [BuiltKit].  This should work by default starting with
+docker 23.0, or podman/buildah v1.33.  For older versions of docker, it can be
+activated with `DOCKER_BUILDKIT=1` in the environment.
+
+If you define the `PUSH` environment variable when running the
 former `make` command, it will push the container to the [registry] if
 you have access to do so and have your Docker logged into the registry.
 
@@ -101,6 +108,7 @@  env CONTAINER_NO_PULL=1 \
 make -C automation/build suse/opensuse-tumbleweed PUSH=1
 ```
 
+[BuildKit]: https://docs.docker.com/build/buildkit/
 [registry]: https://gitlab.com/xen-project/xen/container_registry
 [registry help]: https://gitlab.com/help/user/project/container_registry
 
diff --git a/automation/build/alpine/3.18-arm64v8.dockerfile b/automation/build/alpine/3.18-arm64v8.dockerfile
index 91e90220240f..19fe46f8418f 100644
--- a/automation/build/alpine/3.18-arm64v8.dockerfile
+++ b/automation/build/alpine/3.18-arm64v8.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 alpine:3.18
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/alpine/3.18.dockerfile b/automation/build/alpine/3.18.dockerfile
index 8d5dac05b01f..263e9e90d888 100644
--- a/automation/build/alpine/3.18.dockerfile
+++ b/automation/build/alpine/3.18.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 alpine:3.18
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/archlinux/current-riscv64.dockerfile b/automation/build/archlinux/current-riscv64.dockerfile
index af75b5c720ce..f7770bf82a78 100644
--- a/automation/build/archlinux/current-riscv64.dockerfile
+++ b/automation/build/archlinux/current-riscv64.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 archlinux
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index d29f1358c2bd..8929e9b5f022 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 archlinux:base-devel
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/centos/7.dockerfile b/automation/build/centos/7.dockerfile
index 1cdc16fc05f9..657550f308bb 100644
--- a/automation/build/centos/7.dockerfile
+++ b/automation/build/centos/7.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 centos:7
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile b/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
index a05ffeac04f9..95b3f0428372 100644
--- a/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
+++ b/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/bookworm-arm64v8.dockerfile b/automation/build/debian/bookworm-arm64v8.dockerfile
index 2c432aacb765..3ab426a082d3 100644
--- a/automation/build/debian/bookworm-arm64v8.dockerfile
+++ b/automation/build/debian/bookworm-arm64v8.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/bookworm-cppcheck.dockerfile b/automation/build/debian/bookworm-cppcheck.dockerfile
index 633268376d56..fe4cd4a1aaab 100644
--- a/automation/build/debian/bookworm-cppcheck.dockerfile
+++ b/automation/build/debian/bookworm-cppcheck.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 debian:bookworm AS builder
 
 ENV DEBIAN_FRONTEND=noninteractive
diff --git a/automation/build/debian/bookworm-i386.dockerfile b/automation/build/debian/bookworm-i386.dockerfile
index 89a650338566..9a54bd7293dc 100644
--- a/automation/build/debian/bookworm-i386.dockerfile
+++ b/automation/build/debian/bookworm-i386.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/i386 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index d893218fc4bd..bef44dd75300 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/bullseye-ppc64le.dockerfile b/automation/build/debian/bullseye-ppc64le.dockerfile
index 6fdfb6bc2b40..e166d205f38c 100644
--- a/automation/build/debian/bullseye-ppc64le.dockerfile
+++ b/automation/build/debian/bullseye-ppc64le.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:bullseye-slim
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/buster-gcc-ibt.dockerfile b/automation/build/debian/buster-gcc-ibt.dockerfile
index 6a3e50ef6b3f..ed9367aafbec 100644
--- a/automation/build/debian/buster-gcc-ibt.dockerfile
+++ b/automation/build/debian/buster-gcc-ibt.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:buster-slim AS builder
 
 ENV DEBIAN_FRONTEND=noninteractive
diff --git a/automation/build/debian/jessie-i386.dockerfile b/automation/build/debian/jessie-i386.dockerfile
index a8dec82bb299..f6eaa94ee523 100644
--- a/automation/build/debian/jessie-i386.dockerfile
+++ b/automation/build/debian/jessie-i386.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/i386 debian/eol:jessie
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/jessie.dockerfile b/automation/build/debian/jessie.dockerfile
index 308675cac150..a870e743fcaf 100644
--- a/automation/build/debian/jessie.dockerfile
+++ b/automation/build/debian/jessie.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian/eol:jessie
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/stretch-i386.dockerfile b/automation/build/debian/stretch-i386.dockerfile
index da93fed8ea68..ad8db692aaf2 100644
--- a/automation/build/debian/stretch-i386.dockerfile
+++ b/automation/build/debian/stretch-i386.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/i386 debian:stretch
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/debian/stretch.dockerfile b/automation/build/debian/stretch.dockerfile
index 59794ed4677b..4dfd40b54277 100644
--- a/automation/build/debian/stretch.dockerfile
+++ b/automation/build/debian/stretch.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:stretch
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/fedora/29.dockerfile b/automation/build/fedora/29.dockerfile
index f473ae13e7c1..08edf70838f9 100644
--- a/automation/build/fedora/29.dockerfile
+++ b/automation/build/fedora/29.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 fedora:29
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/suse/opensuse-leap.dockerfile b/automation/build/suse/opensuse-leap.dockerfile
index 3ef33458a07c..28d333881233 100644
--- a/automation/build/suse/opensuse-leap.dockerfile
+++ b/automation/build/suse/opensuse-leap.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 opensuse/leap
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/suse/opensuse-tumbleweed.dockerfile b/automation/build/suse/opensuse-tumbleweed.dockerfile
index a793601c876d..077fed22260c 100644
--- a/automation/build/suse/opensuse-tumbleweed.dockerfile
+++ b/automation/build/suse/opensuse-tumbleweed.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 opensuse/tumbleweed
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/ubuntu/bionic.dockerfile b/automation/build/ubuntu/bionic.dockerfile
index 910d3c4b5315..cc43fc4ade12 100644
--- a/automation/build/ubuntu/bionic.dockerfile
+++ b/automation/build/ubuntu/bionic.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 ubuntu:18.04
 LABEL maintainer.name="The Xen Project " \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/ubuntu/focal.dockerfile b/automation/build/ubuntu/focal.dockerfile
index 078abd56d56f..cb8bb2f6faee 100644
--- a/automation/build/ubuntu/focal.dockerfile
+++ b/automation/build/ubuntu/focal.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 ubuntu:20.04
 LABEL maintainer.name="The Xen Project " \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/ubuntu/trusty.dockerfile b/automation/build/ubuntu/trusty.dockerfile
index 8bd8c085a781..e2a1bda7c3a8 100644
--- a/automation/build/ubuntu/trusty.dockerfile
+++ b/automation/build/ubuntu/trusty.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 ubuntu:14.04
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/ubuntu/xenial-xilinx.dockerfile b/automation/build/ubuntu/xenial-xilinx.dockerfile
index 49f27b322995..f03d62e8bd3f 100644
--- a/automation/build/ubuntu/xenial-xilinx.dockerfile
+++ b/automation/build/ubuntu/xenial-xilinx.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 ubuntu:16.04
 LABEL maintainer.name="The Xen Project " \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/ubuntu/xenial.dockerfile b/automation/build/ubuntu/xenial.dockerfile
index f6296d32925c..168bc70ffad8 100644
--- a/automation/build/ubuntu/xenial.dockerfile
+++ b/automation/build/ubuntu/xenial.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 ubuntu:16.04
 LABEL maintainer.name="The Xen Project " \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/build/yocto/yocto.dockerfile.in b/automation/build/yocto/yocto.dockerfile.in
index b0892d420377..fbaa4e191caa 100644
--- a/automation/build/yocto/yocto.dockerfile.in
+++ b/automation/build/yocto/yocto.dockerfile.in
@@ -1,3 +1,5 @@ 
+# syntax=docker/dockerfile:1
+
 # Docker file to create an environment to build yocto with virtualization
 #
 # Arguments that can be passed during image creation using --build-arg:
diff --git a/automation/tests-artifacts/alpine/3.18-arm64v8.dockerfile b/automation/tests-artifacts/alpine/3.18-arm64v8.dockerfile
index 0e5ae7f2b4d8..a4542f703997 100644
--- a/automation/tests-artifacts/alpine/3.18-arm64v8.dockerfile
+++ b/automation/tests-artifacts/alpine/3.18-arm64v8.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 alpine:3.18
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/tests-artifacts/alpine/3.18.dockerfile b/automation/tests-artifacts/alpine/3.18.dockerfile
index 9cde6c9ad4da..311a92889b87 100644
--- a/automation/tests-artifacts/alpine/3.18.dockerfile
+++ b/automation/tests-artifacts/alpine/3.18.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 alpine:3.18
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
index b0875ca0ddd1..22359c906630 100644
--- a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
+++ b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/tests-artifacts/kernel/6.1.19.dockerfile b/automation/tests-artifacts/kernel/6.1.19.dockerfile
index 021bde26c790..5cf53d290c6f 100644
--- a/automation/tests-artifacts/kernel/6.1.19.dockerfile
+++ b/automation/tests-artifacts/kernel/6.1.19.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile b/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
index fb7b7b506e94..e9f5576be7a6 100644
--- a/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
+++ b/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/arm64/v8 debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
diff --git a/automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile b/automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile
index 65857147bf4f..e28d68649239 100644
--- a/automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile
+++ b/automation/tests-artifacts/qemu-system-ppc64/8.1.0-ppc64.dockerfile
@@ -1,3 +1,4 @@ 
+# syntax=docker/dockerfile:1
 FROM --platform=linux/amd64 debian:bullseye-slim
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"