Skip to content

Commit

Permalink
add docker tooling to verify and show how to setup it
Browse files Browse the repository at this point in the history
Signed-off-by: Romain Gautier <[email protected]>
  • Loading branch information
mykiwi committed Jan 3, 2025
1 parent 48f0296 commit 0719d54
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Makefile
Dockerfile
docker-bake.hcl
tests-docker-output

*.lo
*.o
.deps
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ tests/*.mem
tmp-php.ini

coverage_report/**

tests-docker-output
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# syntax=docker/dockerfile:1

FROM php_specified_version AS build

RUN <<EOF
apt update
apt upgrade -y

apt-get install -y build-essential git libnode-dev

cp -s /usr/lib/`uname -m`-linux-gnu/libv8* /usr/local/lib/
cp -rs /usr/include/node/* /usr/local/include/
EOF

#RUN git clone https://github.com/phpv8/v8js.git --branch php8 /tmp/php-v8js
COPY --from=php-v8js-source-code / /tmp/php-v8js
WORKDIR /tmp/php-v8js

RUN <<EOF
phpize
./configure
make -j$(nproc)
make test > 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_* /
23 changes: 23 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
@@ -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/"]
}

0 comments on commit 0719d54

Please sign in to comment.