From 116b72268341c5af9de40aea62a89cfdf0b8d5f2 Mon Sep 17 00:00:00 2001 From: Romain Gautier Date: Sat, 9 Dec 2023 10:34:39 +0100 Subject: [PATCH] add base for docker-bake --- Dockerfile | 3 +++ README.md | 7 +------ docker-bake.hcl | 5 +++++ 3 files changed, 9 insertions(+), 6 deletions(-) create mode 100644 docker-bake.hcl diff --git a/Dockerfile b/Dockerfile index 05b84f685..d9fde5dae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -123,3 +123,6 @@ RUN mkdir /build && cd /src/php-src && emcc $OPTIMIZE \ -lidbfs.js \ /src/phpw.o /src/usr/lib/sqlite3.o .libs/libphp.a /src/usr/lib/libxml2.a RUN rm -r /src/* + +FROM scratch +COPY --from=php-wasm /build/ . diff --git a/README.md b/README.md index 1524a2e91..9866b3cca 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,7 @@ I fixed some inconsistencies in the Makefile and removed non-essential things. T ## Build ``` -docker build . -t php-wasm -# create a temporary container -docker create --name=php-wasm php-wasm -# to copy builded files -docker cp php-wasm:/build/php-web.wasm ./build -docker cp php-wasm:/build/php-web.mjs ./build/php-web.mjs +docker buildx bake ``` Builded files will be located in `build/php-web.js` and `build/php-web.wasm`. diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 000000000..94975c61f --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,5 @@ +target "default" { + context = "./" + output = ["type=local,dest=./build"] + tags = ["php-wasm"] +}