Skip to content

Commit

Permalink
WIP: feat(docker): build multiarch amd64,arm64 images
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Mar 26, 2024
1 parent 169a2e0 commit 76785e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/docker/itk-wasm-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=dockcross/web-wasm
FROM $BASE_IMAGE:20230622-7312d8f
FROM $BASE_IMAGE:20240326-00e7558
ARG BASE_IMAGE

LABEL maintainer="Matt McCormick <matt.mccormick@kitware.com>"
Expand Down
19 changes: 11 additions & 8 deletions src/docker/itk-wasm-base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
debug=false
wasi=false
version_tag=false
build_cmd=build
for param; do
if [[ $param == '--with-debug' ]]; then
debug=true
elif [[ $param == '--with-wasi' ]]; then
wasi=true
elif [[ $param == '--multiarch' ]]; then
build_cmd="buildx build --platform linux/amd64,linux/arm64"
elif [[ $param == '--version-tag' ]]; then
version_tag=true
else
Expand All @@ -36,15 +39,15 @@ emscripten_debug_c_flags="-fno-lto -Wno-warn-absolute-paths"
wasi_debug_ld_flags="-fno-lto -lwasi-emulated-process-clocks -lwasi-emulated-signal -lc-printscan-long-double"
wasi_debug_c_flags="-fno-lto -D_WASI_EMULATED_PROCESS_CLOCKS -D_WASI_EMULATED_SIGNAL"

$exe build -t itkwasm/emscripten-base:latest \
$exe $build_cmd -t itkwasm/emscripten-base:latest \
--build-arg IMAGE=itkwasm/emscripten-base \
--build-arg CMAKE_BUILD_TYPE=Release \
--build-arg VCS_REF=${VCS_REF} \
--build-arg VCS_URL=${VCS_URL} \
--build-arg BUILD_DATE=${BUILD_DATE} \
$script_dir $@
if $version_tag; then
$exe build -t itkwasm/emscripten-base:${TAG} \
$exe $build_cmd -t itkwasm/emscripten-base:${TAG} \
--build-arg IMAGE=itkwasm/emscripten-base \
--build-arg CMAKE_BUILD_TYPE=Release \
--build-arg VERSION=${TAG} \
Expand All @@ -55,7 +58,7 @@ if $version_tag; then
fi

if $wasi; then
$exe build -t itkwasm/wasi-base:latest \
$exe $build_cmd -t itkwasm/wasi-base:latest \
--build-arg IMAGE=itkwasm/wasi-base \
--build-arg CMAKE_BUILD_TYPE=Release \
--build-arg VCS_REF=${VCS_REF} \
Expand All @@ -66,7 +69,7 @@ if $wasi; then
--build-arg CFLAGS="${wasi_c_flags}" \
$script_dir $@
if $version_tag; then
$exe build -t itkwasm/wasi-base:${TAG} \
$exe $build_cmd -t itkwasm/wasi-base:${TAG} \
--build-arg IMAGE=itkwasm/wasi-base \
--build-arg CMAKE_BUILD_TYPE=Release \
--build-arg VERSION=${TAG} \
Expand All @@ -82,7 +85,7 @@ fi


if $debug; then
$exe build -t itkwasm/emscripten-base:latest-debug \
$exe $build_cmd -t itkwasm/emscripten-base:latest-debug \
--build-arg IMAGE=itkwasm/emscripten-base \
--build-arg CMAKE_BUILD_TYPE=Debug \
--build-arg USE_DCMTK=OFF \
Expand All @@ -93,7 +96,7 @@ if $debug; then
--build-arg CFLAGS="${emscripten_debug_c_flags}" \
$script_dir $@
if $version_tag; then
$exe build -t itkwasm/emscripten-base:${TAG}-debug \
$exe $build_cmd -t itkwasm/emscripten-base:${TAG}-debug \
--build-arg IMAGE=itkwasm/emscripten-base \
--build-arg CMAKE_BUILD_TYPE=Debug \
--build-arg USE_DCMTK=OFF \
Expand All @@ -106,7 +109,7 @@ if $debug; then
$script_dir $@
fi
if $wasi; then
$exe build -t itkwasm/wasi-base:latest-debug \
$exe $build_cmd -t itkwasm/wasi-base:latest-debug \
--build-arg IMAGE=itkwasm/wasi-base \
--build-arg CMAKE_BUILD_TYPE=Debug \
--build-arg VCS_REF=${VCS_REF} \
Expand All @@ -117,7 +120,7 @@ if $debug; then
--build-arg CFLAGS="${wasi_debug_c_flags}" \
$script_dir $@
if $version_tag; then
$exe build -t itkwasm/wasi-base:${TAG}-debug \
$exe $build_cmd -t itkwasm/wasi-base:${TAG}-debug \
--build-arg IMAGE=itkwasm/wasi-base \
--build-arg CMAKE_BUILD_TYPE=Debug \
--build-arg VERSION=${TAG} \
Expand Down

0 comments on commit 76785e1

Please sign in to comment.