From 0719d543a0f88b7e3bd29ce0426c60ea1e728347 Mon Sep 17 00:00:00 2001 From: Romain Gautier Date: Fri, 3 Jan 2025 19:17:04 +0100 Subject: [PATCH] add docker tooling to verify and show how to setup it Signed-off-by: Romain Gautier --- .dockerignore | 5 +++++ .gitignore | 2 ++ Dockerfile | 30 ++++++++++++++++++++++++++++++ docker-bake.hcl | 23 +++++++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-bake.hcl diff --git a/.dockerignore b/.dockerignore index 967e56a1..3e59b8b2 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,8 @@ +Makefile +Dockerfile +docker-bake.hcl +tests-docker-output + *.lo *.o .deps diff --git a/.gitignore b/.gitignore index 10a94aac..83045a71 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ tests/*.mem tmp-php.ini coverage_report/** + +tests-docker-output diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..a43bc6e2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# syntax=docker/dockerfile:1 + +FROM php_specified_version AS build + +RUN < php$(php -r 'echo PHP_VERSION;')_$(uname -m)-make_test_std 2>&1 || true + ls php_test_results_*.txt && mv php_test_results_*.txt php$(php -r 'echo PHP_VERSION;')_$(uname -m)-make_test_report || true +EOF + + + +FROM scratch +COPY --from=build /tmp/php-v8js/*-make_test_* / diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 00000000..72ce1678 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,23 @@ +## Usage: +# docker buildx bake +# PHP_VERSION=8.3 docker buildx bake +# PHP_VERSION=8.2 docker buildx bake +# PHP_VERSION=8.1 docker buildx bake + +group "default" { + targets = ["main"] + platforms = ["linux/amd64", "linux/arm64"] +} + +variable "PHP_VERSION" { + default = "8.4" +} + +target "main" { + dockerfile = "Dockerfile" + contexts = { + "php_specified_version" = "docker-image://php:${PHP_VERSION}" + "php-v8js-source-code" = "https://github.com/phpv8/v8js.git#php8" + } + output = ["type=local,dest=tests-docker-output/"] +}