Skip to content

Commit 0719d54

Browse files
committed
add docker tooling to verify and show how to setup it
Signed-off-by: Romain Gautier <[email protected]>
1 parent 48f0296 commit 0719d54

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Makefile
2+
Dockerfile
3+
docker-bake.hcl
4+
tests-docker-output
5+
16
*.lo
27
*.o
38
.deps

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,5 @@ tests/*.mem
4444
tmp-php.ini
4545

4646
coverage_report/**
47+
48+
tests-docker-output

Dockerfile

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM php_specified_version AS build
4+
5+
RUN <<EOF
6+
apt update
7+
apt upgrade -y
8+
9+
apt-get install -y build-essential git libnode-dev
10+
11+
cp -s /usr/lib/`uname -m`-linux-gnu/libv8* /usr/local/lib/
12+
cp -rs /usr/include/node/* /usr/local/include/
13+
EOF
14+
15+
#RUN git clone https://github.com/phpv8/v8js.git --branch php8 /tmp/php-v8js
16+
COPY --from=php-v8js-source-code / /tmp/php-v8js
17+
WORKDIR /tmp/php-v8js
18+
19+
RUN <<EOF
20+
phpize
21+
./configure
22+
make -j$(nproc)
23+
make test > php$(php -r 'echo PHP_VERSION;')_$(uname -m)-make_test_std 2>&1 || true
24+
ls php_test_results_*.txt && mv php_test_results_*.txt php$(php -r 'echo PHP_VERSION;')_$(uname -m)-make_test_report || true
25+
EOF
26+
27+
28+
29+
FROM scratch
30+
COPY --from=build /tmp/php-v8js/*-make_test_* /

docker-bake.hcl

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Usage:
2+
# docker buildx bake
3+
# PHP_VERSION=8.3 docker buildx bake
4+
# PHP_VERSION=8.2 docker buildx bake
5+
# PHP_VERSION=8.1 docker buildx bake
6+
7+
group "default" {
8+
targets = ["main"]
9+
platforms = ["linux/amd64", "linux/arm64"]
10+
}
11+
12+
variable "PHP_VERSION" {
13+
default = "8.4"
14+
}
15+
16+
target "main" {
17+
dockerfile = "Dockerfile"
18+
contexts = {
19+
"php_specified_version" = "docker-image://php:${PHP_VERSION}"
20+
"php-v8js-source-code" = "https://github.com/phpv8/v8js.git#php8"
21+
}
22+
output = ["type=local,dest=tests-docker-output/"]
23+
}

0 commit comments

Comments
 (0)