From 94332ccdaab910af3226f36acbfc3c45907f2670 Mon Sep 17 00:00:00 2001 From: Romain Gautier Date: Sun, 10 Dec 2023 14:45:50 +0100 Subject: [PATCH] add docker-bake (#5) * add base for docker-bake * simplify config * use tab --- Dockerfile | 3 +++ README.md | 7 +------ docker-bake.hcl | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 docker-bake.hcl diff --git a/Dockerfile b/Dockerfile index 548ed3928..a54f248c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -128,3 +128,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 685c63dae..fa47a9697 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..00bd33e59 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,4 @@ +target "default" { + output = ["type=local,dest=./build"] + tags = ["php-wasm"] +}