diff --git a/pixi.lock b/pixi.lock index 3f00b47f1..53a1778b4 100644 --- a/pixi.lock +++ b/pixi.lock @@ -41,15 +41,25 @@ environments: - conda: https://conda.anaconda.org/conda-forge/linux-aarch64/zlib-1.3.1-h68df207_1.conda osx-arm64: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ca-certificates-2024.7.4-hf0a4a13_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/gettext-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/gettext-tools-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/icu-75.1-hfee45f7_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/jq-1.7.1-h93a5062_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libasprintf-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libasprintf-devel-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libcxx-18.1.8-h5a72898_4.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libgettextpo-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libgettextpo-devel-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libiconv-1.17-h0d3ecfb_2.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libintl-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libintl-devel-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libuv-1.49.2-h7ab814d_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libzlib-1.3.1-hfb2fe0b_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/nodejs-22.12.0-h02a13b7_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/oniguruma-6.9.9-h93a5062_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.4.0-h39f12f2_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pnpm-9.15.1-h7c8fa8f_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/sed-4.8-hc6a1b29_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/zlib-1.3.1-hfb2fe0b_1.conda win-64: - conda: https://conda.anaconda.org/conda-forge/win-64/m2w64-gcc-libgfortran-5.3.0-6.tar.bz2 @@ -192,18 +202,26 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/compiler-rt-16.0.6-h3808999_2.conda - conda: https://conda.anaconda.org/conda-forge/noarch/compiler-rt_osx-arm64-16.0.6-h3808999_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/cxx-compiler-1.7.0-h2ffa867_1.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/gettext-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/gettext-tools-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/icu-75.1-hfee45f7_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/jq-1.7.1-h93a5062_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/krb5-1.21.3-h237132a_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ld64-711-h634c8be_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/ld64_osx-arm64-711-h4c89ff5_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libasprintf-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libasprintf-devel-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libclang-cpp16-16.0.6-default_h5c12605_11.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libcurl-8.9.1-hfd8ffcc_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libcxx-18.1.8-h5a72898_4.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libedit-3.1.20191231-hc8eb9b7_2.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libev-4.33-h93a5062_2.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libexpat-2.6.2-hebf3989_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libgettextpo-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libgettextpo-devel-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libiconv-1.17-h0d3ecfb_2.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libintl-0.22.5-h8414b35_3.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libintl-devel-0.22.5-h8414b35_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libllvm16-16.0.6-haab561b_3.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libnghttp2-1.58.0-ha4dd798_1.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libssh2-1.11.0-h7a5bd25_0.conda @@ -219,6 +237,7 @@ environments: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/openssl-3.4.0-h39f12f2_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/pnpm-9.15.1-h7c8fa8f_0.conda - conda: https://conda.anaconda.org/conda-forge/osx-arm64/rhash-1.4.4-hb547adb_0.conda + - conda: https://conda.anaconda.org/conda-forge/osx-arm64/sed-4.8-hc6a1b29_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/sigtool-0.1.3-h44b9a77_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/tapi-1100.0.11-he4954df_0.tar.bz2 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/xz-5.2.6-h57fd34a_0.tar.bz2 @@ -807,6 +826,38 @@ packages: license_family: BSD size: 31511 timestamp: 1721141544805 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/gettext-0.22.5-h8414b35_3.conda + sha256: 634e11f6e6560568ede805f823a2be8634c6a0a2fa6743880ec403d925923138 + md5: 89b31a91b3ac2b7b3b0e5bc4eb99c39d + depends: + - __osx >=11.0 + - gettext-tools 0.22.5 h8414b35_3 + - libasprintf 0.22.5 h8414b35_3 + - libasprintf-devel 0.22.5 h8414b35_3 + - libcxx >=16 + - libgettextpo 0.22.5 h8414b35_3 + - libgettextpo-devel 0.22.5 h8414b35_3 + - libiconv >=1.17,<2.0a0 + - libintl 0.22.5 h8414b35_3 + - libintl-devel 0.22.5 h8414b35_3 + arch: arm64 + platform: osx + license: LGPL-2.1-or-later AND GPL-3.0-or-later + size: 483255 + timestamp: 1723627203687 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/gettext-tools-0.22.5-h8414b35_3.conda + sha256: 50b530cf2326938b80330f78cf4056492fa8c6a5c7e313d92069ebbbb2f4d264 + md5: 47071f4b2915032e1d47119f779f9d9c + depends: + - __osx >=11.0 + - libiconv >=1.17,<2.0a0 + - libintl 0.22.5 h8414b35_3 + arch: arm64 + platform: osx + license: GPL-3.0-or-later + license_family: GPL + size: 2467439 + timestamp: 1723627140130 - conda: https://conda.anaconda.org/conda-forge/linux-64/gxx-12.4.0-h236703b_0.conda sha256: c72b4b41ce3d05ca87299276c0bd5579bf21064a3993e6aebdaca49f021bbea7 md5: 56cefffbce52071b597fd3eb9208adc9 @@ -1077,6 +1128,28 @@ packages: license_family: GPL size: 735885 timestamp: 1718625653417 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libasprintf-0.22.5-h8414b35_3.conda + sha256: 819bf95543470658f48db53a267a3fabe1616797c4031cf88e63f451c5029e6f + md5: 472b673c083175195965a48f2f4808f8 + depends: + - __osx >=11.0 + - libcxx >=16 + arch: arm64 + platform: osx + license: LGPL-2.1-or-later + size: 40657 + timestamp: 1723626937704 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libasprintf-devel-0.22.5-h8414b35_3.conda + sha256: ca7322f7c3f1a68cb36630eaa88a44c774261150d42d70a4be3d77bc9ed28d5d + md5: a03ca97f9fabf5626660697c2e0b8850 + depends: + - __osx >=11.0 + - libasprintf 0.22.5 h8414b35_3 + arch: arm64 + platform: osx + license: LGPL-2.1-or-later + size: 34648 + timestamp: 1723626983419 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libclang-cpp16-16.0.6-default_h5c12605_11.conda sha256: de6ab5964f044488791c5630b1aa27cd32cfc397ccfb0076070497d8415ae638 md5: 482131c507a73d5101e15096757ff3d4 @@ -1310,6 +1383,33 @@ packages: license_family: GPL size: 54104 timestamp: 1729089444587 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libgettextpo-0.22.5-h8414b35_3.conda + sha256: bc446fad58155e96a01b28e99254415c2151bdddf57f9a2c00c44e6f0298bb62 + md5: c8cd7295cfb7bda5cbabea4fef904349 + depends: + - __osx >=11.0 + - libiconv >=1.17,<2.0a0 + - libintl 0.22.5 h8414b35_3 + arch: arm64 + platform: osx + license: GPL-3.0-or-later + license_family: GPL + size: 159800 + timestamp: 1723627007035 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libgettextpo-devel-0.22.5-h8414b35_3.conda + sha256: ea3ca757bf11ed25965b39466b50411c7c2a43f3b90ab4a36fc0ef43f7ab98ac + md5: 7074dc1c9aae1bb5d7bccb4ff03746ca + depends: + - __osx >=11.0 + - libgettextpo 0.22.5 h8414b35_3 + - libiconv >=1.17,<2.0a0 + - libintl 0.22.5 h8414b35_3 + arch: arm64 + platform: osx + license: GPL-3.0-or-later + license_family: GPL + size: 37153 + timestamp: 1723627048279 - conda: https://conda.anaconda.org/conda-forge/linux-64/libgomp-14.2.0-h77fa898_1.conda sha256: 1911c29975ec99b6b906904040c855772ccb265a1c79d5d75c8ceec4ed89cd63 md5: cc3573974587f12dda90d96e3e55a702 @@ -1329,9 +1429,34 @@ packages: - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libiconv-1.17-h0d3ecfb_2.conda sha256: bc7de5097b97bcafcf7deaaed505f7ce02f648aac8eccc0d5a47cc599a1d0304 md5: 69bda57310071cf6d2b86caf11573d2d + arch: arm64 + platform: osx license: LGPL-2.1-only size: 676469 timestamp: 1702682458114 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libintl-0.22.5-h8414b35_3.conda + sha256: 7c1d238d4333af385e594c89ebcb520caad7ed83a735c901099ec0970a87a891 + md5: 3b98ec32e91b3b59ad53dbb9c96dd334 + depends: + - __osx >=11.0 + - libiconv >=1.17,<2.0a0 + arch: arm64 + platform: osx + license: LGPL-2.1-or-later + size: 81171 + timestamp: 1723626968270 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/libintl-devel-0.22.5-h8414b35_3.conda + sha256: c9d1d4fdfb5775828e54bc9fb443b1a6de9319a04b81d1bac52c26114a763154 + md5: 271646de11b018c66e81eb4c4717b291 + depends: + - __osx >=11.0 + - libiconv >=1.17,<2.0a0 + - libintl 0.22.5 h8414b35_3 + arch: arm64 + platform: osx + license: LGPL-2.1-or-later + size: 38584 + timestamp: 1723627022409 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/libllvm16-16.0.6-haab561b_3.conda sha256: f240f3776b02c39a32ce7397d6f2de072510321c835f4def452fc62e5c3babc0 md5: 9900d62ede9ce25b569beeeab1da094e @@ -1514,8 +1639,6 @@ packages: depends: - __glibc >=2.17,<3.0.a0 - libgcc >=13 - arch: x86_64 - platform: linux license: MIT license_family: MIT size: 884647 @@ -1525,8 +1648,6 @@ packages: md5: 1899e1ec2be63386c41c4db31d3056af depends: - libgcc >=13 - arch: aarch64 - platform: linux license: MIT license_family: MIT size: 627484 @@ -1536,8 +1657,6 @@ packages: md5: 4bc348e3a1a74d20a3f9beb866d75e0a depends: - __osx >=11.0 - arch: arm64 - platform: osx license: MIT license_family: MIT size: 410500 @@ -1786,8 +1905,6 @@ packages: - libzlib >=1.3.1,<2.0a0 - openssl >=3.4.0,<4.0a0 - zlib - arch: x86_64 - platform: linux license: MIT license_family: MIT size: 21796933 @@ -1804,8 +1921,6 @@ packages: - libzlib >=1.3.1,<2.0a0 - openssl >=3.4.0,<4.0a0 - zlib - arch: aarch64 - platform: linux license: MIT license_family: MIT size: 22195558 @@ -1821,8 +1936,6 @@ packages: - libzlib >=1.3.1,<2.0a0 - openssl >=3.4.0,<4.0a0 - zlib - arch: arm64 - platform: osx license: MIT license_family: MIT size: 15429539 @@ -1830,8 +1943,6 @@ packages: - conda: https://conda.anaconda.org/conda-forge/win-64/nodejs-22.12.0-hfeaa22a_0.conda sha256: 43d728b5d56ffeea5e95308218d7045acabcd318ced6ad4f2e89f295666aadda md5: 4e1fa4ec4147ec961f75a3b6f7a558af - arch: x86_64 - platform: win license: MIT license_family: MIT size: 26256775 @@ -1868,8 +1979,6 @@ packages: - __glibc >=2.17,<3.0.a0 - ca-certificates - libgcc >=13 - arch: x86_64 - platform: linux license: Apache-2.0 license_family: Apache size: 2947466 @@ -1880,8 +1989,6 @@ packages: depends: - ca-certificates - libgcc >=13 - arch: aarch64 - platform: linux license: Apache-2.0 license_family: Apache size: 3474825 @@ -1892,8 +1999,6 @@ packages: depends: - __osx >=11.0 - ca-certificates - arch: arm64 - platform: osx license: Apache-2.0 license_family: Apache size: 2935176 @@ -1920,8 +2025,6 @@ packages: - libgcc >=13 - libstdcxx >=13 - nodejs >=22.12.0,<23.0a0 - arch: x86_64 - platform: linux license: MIT license_family: MIT size: 3320013 @@ -1933,8 +2036,6 @@ packages: - libgcc >=13 - libstdcxx >=13 - nodejs >=22.12.0,<23.0a0 - arch: aarch64 - platform: linux license: MIT license_family: MIT size: 3230369 @@ -1946,8 +2047,6 @@ packages: - __osx >=11.0 - libcxx >=18 - nodejs >=22.12.0,<23.0a0 - arch: arm64 - platform: osx license: MIT license_family: MIT size: 3324788 @@ -1960,8 +2059,6 @@ packages: - ucrt >=10.0.20348.0 - vc >=14.2,<15 - vc14_runtime >=14.29.30139 - arch: x86_64 - platform: win license: MIT license_family: MIT size: 3290543 @@ -1991,6 +2088,17 @@ packages: license_family: MIT size: 177491 timestamp: 1693456037505 +- conda: https://conda.anaconda.org/conda-forge/osx-arm64/sed-4.8-hc6a1b29_0.tar.bz2 + sha256: a9c4193ccfa633aa7ab37aa95c7d28101a1df45b27efcaf28828d7266c2d43c1 + md5: 1b410382feb5302344180b25df05b591 + depends: + - gettext >=0.19.2 + - gettext >=0.19.8.1,<1.0a0 + arch: arm64 + platform: osx + license: GPL-3 + size: 279194 + timestamp: 1605307517437 - conda: https://conda.anaconda.org/conda-forge/osx-arm64/sigtool-0.1.3-h44b9a77_0.tar.bz2 sha256: 70791ae00a3756830cb50451db55f63e2a42a2fa2a8f1bab1ebd36bbb7d55bff md5: 4a2cac04f86a4540b8c9b8d8f597848f diff --git a/pixi.toml b/pixi.toml index e93854f5c..fa121c4b0 100644 --- a/pixi.toml +++ b/pixi.toml @@ -92,7 +92,7 @@ description = "Update the default Docker image tag" [tasks.build-docker-images] cmd = "src/docker/build.sh" description = "Build the ITK-Wasm docker images" -depends-on = ["clean", "export-itk-wasm-env-vars", "update-default-image-tag"] +depends-on = ["export-itk-wasm-env-vars", "update-default-image-tag"] [dependencies] pnpm = ">=9.15.1,<10" @@ -104,6 +104,9 @@ m2w64-jq = ">=1.6.0,<2" [target.unix.dependencies] jq = ">=1.7.1,<2" +[target.osx-arm64.dependencies] +sed = ">=4.8,<5" + [feature.native.tasks.clone-itk] cmd = ["stat", "$ITK_WASM_ITK_SOURCE_DIR", ">/dev/null", "||", "git", "clone", diff --git a/src/docker/RELEASE.md b/src/docker/RELEASE.md index 22011e623..94c8f9896 100644 --- a/src/docker/RELEASE.md +++ b/src/docker/RELEASE.md @@ -3,9 +3,6 @@ Verify the source tree. ``` -# Remove all old podman images -podman rmi $(podman images -qa) -f -podman rmi $(podman images -qa) -f pixi run build-docker-images --with-debug --multiarch # DockerHub credential environmental variables must be set diff --git a/src/docker/itk-wasm-base/Dockerfile b/src/docker/itk-wasm-base/Dockerfile index 4ee0ccf69..c11ed0056 100644 --- a/src/docker/itk-wasm-base/Dockerfile +++ b/src/docker/itk-wasm-base/Dockerfile @@ -1,8 +1,9 @@ ARG BASE_IMAGE=docker.io/dockcross/web-wasm -FROM $BASE_IMAGE:20241227-d0e5a43 +ARG HOST_ARCH=amd64 +FROM $BASE_IMAGE:20241229-8cdda7e-$HOST_ARCH ARG BASE_IMAGE -LABEL maintainer="Matt McCormick " +LABEL maintainer="Matt McCormick matt@mmmccormick.com" LABEL org.opencontainers.image.source="https://github.com/InsightSoftwareConsortium/ITK-Wasm" WORKDIR / @@ -10,14 +11,9 @@ WORKDIR / COPY itk_wasm_env_vars.sh / # Note: on entry, emsdk will prepend to the path with its own node, so add to an earlier path -ENV NODE_TAG v20.12.2 -RUN curl -LO https://nodejs.org/dist/${NODE_TAG}/node-${NODE_TAG}-linux-x64.tar.xz && \ - tar xvJf node-${NODE_TAG}-linux-x64.tar.xz && \ - rm node-${NODE_TAG}-linux-x64.tar.xz && \ - mkdir -p /emsdk/upstream/emscripten/ && \ - ln -s /node-${NODE_TAG}-linux-x64/bin/node /emsdk/upstream/emscripten && \ - ln -s /node-${NODE_TAG}-linux-x64/bin/npm /emsdk/upstream/emscripten && \ - ln -s /node-${NODE_TAG}-linux-x64/bin/npx /emsdk/upstream/emscripten +ENV NODE_TAG v22.9.0 +COPY install-node-js.sh /usr/local/bin/ +RUN /usr/local/bin/install-node-js.sh && rm /usr/local/bin/install-node-js.sh ENV PATH /emsdk/upstream/emscripten:${PATH} ENV zstd_GIT_TAG v1.5.5 diff --git a/src/docker/itk-wasm-base/build.sh b/src/docker/itk-wasm-base/build.sh index 39a6dd639..2eb7b3e36 100755 --- a/src/docker/itk-wasm-base/build.sh +++ b/src/docker/itk-wasm-base/build.sh @@ -16,18 +16,14 @@ wasi=false version_tag=false build_cmd="build" tag_flag="--tag" -create_manifest=false +host_arch=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') for param; do if [[ $param == '--with-debug' ]]; then debug=true elif [[ $param == '--with-wasi' ]]; then wasi=true elif [[ $param == '--multiarch' ]]; then - # Newer buildah (1.28.2) required for multiarch - exe=buildah - build_cmd="build --platform linux/amd64,linux/arm64" - tag_flag="--manifest" - create_manifest=true + echo "Multiarch not supported" elif [[ $param == '--version-tag' ]]; then version_tag=true else @@ -45,32 +41,18 @@ 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" -if $create_manifest; then - for list in quay.io/itkwasm/emscripten-base:latest \ - quay.io/itkwasm/emscripten-base:${TAG} \ - quay.io/itkwasm/emscripten-base:latest-debug \ - quay.io/itkwasm/emscripten-base:${TAG}-debug \ - quay.io/itkwasm/wasi-base:latest \ - quay.io/itkwasm/wasi-base:${TAG} \ - quay.io/itkwasm/wasi-base:latest-debug \ - quay.io/itkwasm/wasi-base:${TAG}-debug; do - if $(buildah manifest exists $list); then - buildah manifest rm $list - fi - buildah manifest create $list - done -fi - -$exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:latest \ +$exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:latest-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten-base \ + --build-arg HOST_ARCH=$host_arch \ --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_cmd $tag_flag quay.io/itkwasm/emscripten-base:${TAG} \ + $exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:${TAG}-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg VERSION=${TAG} \ --build-arg VCS_REF=${VCS_REF} \ @@ -80,8 +62,9 @@ if $version_tag; then fi if $wasi; then - $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:latest \ + $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:latest-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg VCS_REF=${VCS_REF} \ --build-arg VCS_URL=${VCS_URL} \ @@ -91,8 +74,9 @@ if $wasi; then --build-arg CFLAGS="${wasi_c_flags}" \ $script_dir $@ if $version_tag; then - $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:${TAG} \ + $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:${TAG}-$host_arch \ --build-arg IMAGE=itkwasm/wasi-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg VERSION=${TAG} \ --build-arg VCS_REF=${VCS_REF} \ @@ -107,8 +91,9 @@ fi if $debug; then - $exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:latest-debug \ + $exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:latest-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg USE_DCMTK=OFF \ --build-arg VCS_REF=${VCS_REF} \ @@ -118,8 +103,9 @@ if $debug; then --build-arg CFLAGS="${emscripten_debug_c_flags}" \ $script_dir $@ if $version_tag; then - $exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:${TAG}-debug \ + $exe $build_cmd $tag_flag quay.io/itkwasm/emscripten-base:${TAG}-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg USE_DCMTK=OFF \ --build-arg VERSION=${TAG}-debug \ @@ -131,8 +117,9 @@ if $debug; then $script_dir $@ fi if $wasi; then - $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:latest-debug \ + $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:latest-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg VCS_REF=${VCS_REF} \ --build-arg VCS_URL=${VCS_URL} \ @@ -142,8 +129,9 @@ if $debug; then --build-arg CFLAGS="${wasi_debug_c_flags}" \ $script_dir $@ if $version_tag; then - $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:${TAG}-debug \ + $exe $build_cmd $tag_flag quay.io/itkwasm/wasi-base:${TAG}-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi-base \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg VERSION=${TAG} \ --build-arg VCS_REF=${VCS_REF} \ diff --git a/src/docker/itk-wasm-base/install-node-js.sh b/src/docker/itk-wasm-base/install-node-js.sh new file mode 100755 index 000000000..dd17562e3 --- /dev/null +++ b/src/docker/itk-wasm-base/install-node-js.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -exo pipefail + +host_arch=$(uname -m | sed -e 's/x86_64/x64/' -e 's/aarch64/arm64/') + +curl -LO https://nodejs.org/dist/${NODE_TAG}/node-${NODE_TAG}-linux-${host_arch}.tar.xz +tar xvJf node-${NODE_TAG}-linux-${host_arch}.tar.xz +rm node-${NODE_TAG}-linux-${host_arch}.tar.xz +mkdir -p /emsdk/upstream/emscripten/ +ln -s /node-${NODE_TAG}-linux-${host_arch}/bin/node /emsdk/upstream/emscripten +ln -s /node-${NODE_TAG}-linux-${host_arch}/bin/npm /emsdk/upstream/emscripten +ln -s /node-${NODE_TAG}-linux-${host_arch}/bin/npx /emsdk/upstream/emscripten diff --git a/src/docker/itk-wasm/Dockerfile b/src/docker/itk-wasm/Dockerfile index 2fdeed8e8..3eeadcaf1 100644 --- a/src/docker/itk-wasm/Dockerfile +++ b/src/docker/itk-wasm/Dockerfile @@ -1,8 +1,9 @@ +ARG HOST_ARCH=amd64 ARG BASE_IMAGE=quay.io/itkwasm/emscripten-base -ARG BASE_TAG=latest +ARG BASE_TAG=latest-$HOST_ARCH FROM $BASE_IMAGE:$BASE_TAG -MAINTAINER Insight Software Consortium +LABEL maintainer="Matt McCormick matt@mmmccormick.com" ARG BASE_IMAGE ARG CMAKE_BUILD_TYPE=Release @@ -12,12 +13,12 @@ ADD ITKWebAssemblyInterfaceModuleCopy /ITKWebAssemblyInterface COPY ITKWebAssemblyInterface.cmake /usr/src/ RUN mv /usr/src/ITKWebAssemblyInterface.cmake /usr/share/cmake-*/Modules/ # For non-default toolchain file location -ENV EMSCRIPTEN /emsdk/upstream/emscripten -ENV CMAKE_TOOLCHAIN_FILE_DOCKCROSS ${CMAKE_TOOLCHAIN_FILE} -ENV CMAKE_TOOLCHAIN_FILE_ITK /ITKWebAssemblyInterface/toolchain.cmake +ENV EMSCRIPTEN=/emsdk/upstream/emscripten +ENV CMAKE_TOOLCHAIN_FILE_DOCKCROSS=${CMAKE_TOOLCHAIN_FILE} +ENV CMAKE_TOOLCHAIN_FILE_ITK=/ITKWebAssemblyInterface/toolchain.cmake RUN cp ${CMAKE_TOOLCHAIN_FILE} ${CMAKE_TOOLCHAIN_FILE_ITK} RUN echo "include(ITKWebAssemblyInterface)" >> ${CMAKE_TOOLCHAIN_FILE_ITK} -ENV CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE_ITK} +ENV CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE_ITK} RUN cd / && \ mkdir ITKWebAssemblyInterface-build && \ cd ITKWebAssemblyInterface-build && \ @@ -40,17 +41,8 @@ COPY web-build /usr/local/bin/ # Trigger Emscripten to cache builds of required system libraries ADD median-filter-pipelineCopy /median-filter-pipelineCopy -RUN if [ $BASE_IMAGE = "itkwasm/emscripten-base" ]; then \ - cd /median-filter-pipelineCopy && \ - /usr/local/bin/web-build emscripten-build -DCMAKE_EXE_LINKER_FLAGS='-flto=thin -s DISABLE_EXCEPTION_CATCHING=0' && \ - rm -rf ./web-build && \ - /usr/local/bin/web-build emscripten-build -DCMAKE_EXE_LINKER_FLAGS='-flto -s DISABLE_EXCEPTION_CATCHING=0' && \ - rm -rf ./web-build; /usr/local/bin/web-build emscripten-build -DCMAKE_EXE_LINKER_FLAGS='-fno-lto -s DISABLE_EXCEPTION_CATCHING=1' && \ - rm -rf /median-filter-pipelineCopy && \ - mkdir -p /emsdk/upstream/emscripten/cache/symbol_lists && \ - touch /emsdk/upstream/emscripten/cache/symbol_lists.lock && \ - chmod -R 777 /emsdk/upstream/emscripten/cache \ - fi +COPY warm-emscripten-cache.sh /usr/local/bin +RUN /usr/local/bin/warm-emscripten-cache.sh # Build-time metadata as defined at http://label-schema.org ARG BUILD_DATE @@ -64,5 +56,5 @@ LABEL org.label-schema.build-date=$BUILD_DATE \ org.label-schema.vcs-ref=$VCS_REF \ org.label-schema.vcs-url=$VCS_URL \ org.label-schema.schema-version="1.0" -ENV DEFAULT_DOCKCROSS_IMAGE ${IMAGE}:${VERSION} +ENV DEFAULT_DOCKCROSS_IMAGE=${IMAGE}:${VERSION} WORKDIR /work diff --git a/src/docker/itk-wasm/build.sh b/src/docker/itk-wasm/build.sh index 61fd8eb8d..1a0f930d7 100755 --- a/src/docker/itk-wasm/build.sh +++ b/src/docker/itk-wasm/build.sh @@ -26,6 +26,7 @@ wasi=false version_tag=false build_cmd="build" tag_flag="--tag" +host_arch=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') create_manifest=false for param; do if [[ $param == '--with-debug' ]]; then @@ -33,10 +34,6 @@ for param; do elif [[ $param == '--with-wasi' ]]; then wasi=true elif [[ $param == '--multiarch' ]]; then - # Newer buildah (1.28.2) required for multiarch - exe=buildah - build_cmd="build --platform linux/amd64,linux/arm64" - tag_flag="--manifest" create_manifest=true elif [[ $param == '--version-tag' ]]; then version_tag=true @@ -46,24 +43,9 @@ for param; do done set -- "${newparams[@]}" # overwrites the original positional params -if $create_manifest; then - for list in quay.io/itk-wasm/emscripten:latest \ - quay.io/itk-wasm/emscripten:${TAG} \ - quay.io/itk-wasm/emscripten:latest-debug \ - quay.io/itk-wasm/emscripten:${TAG}-debug \ - quay.io/itk-wasm/wasi:latest \ - quay.io/itk-wasm/wasi:${TAG} \ - quay.io/itk-wasm/wasi:latest-debug \ - quay.io/itk-wasm/wasi:${TAG}-debug; do - if $(buildah manifest exists $list); then - buildah manifest rm $list - fi - buildah manifest create $list - done -fi - -$exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:latest \ +$exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:latest-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg BASE_IMAGE=quay.io/itkwasm/emscripten-base \ --build-arg VCS_REF=${VCS_REF} \ @@ -71,11 +53,12 @@ $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:latest \ --build-arg BUILD_DATE=${BUILD_DATE} \ $script_dir $@ if $version_tag; then - $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:${TAG} \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:${TAG}-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg BASE_IMAGE=quay.io/itkwasm/emscripten-base \ - --build-arg BASE_TAG=${TAG} \ + --build-arg BASE_TAG=${TAG}-$host_arch \ --build-arg VERSION=${TAG} \ --build-arg VCS_REF=${VCS_REF} \ --build-arg VCS_URL=${VCS_URL} \ @@ -84,8 +67,9 @@ if $version_tag; then fi if $wasi; then - $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:latest \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:latest-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg BASE_IMAGE=quay.io/itkwasm/wasi-base \ --build-arg VCS_REF=${VCS_REF} \ @@ -93,11 +77,12 @@ if $wasi; then --build-arg BUILD_DATE=${BUILD_DATE} \ $script_dir $@ if $version_tag; then - $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:${TAG} \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:${TAG}-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Release \ --build-arg VERSION=${TAG} \ - --build-arg BASE_TAG=${TAG} \ + --build-arg BASE_TAG=${TAG}-$host_arch \ --build-arg BASE_IMAGE=quay.io/itkwasm/wasi-base \ --build-arg VCS_REF=${VCS_REF} \ --build-arg VCS_URL=${VCS_URL} \ @@ -107,27 +92,30 @@ if $wasi; then fi if $debug; then - $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:latest-debug \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:latest-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --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_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:${TAG}-debug \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/emscripten:${TAG}-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/emscripten \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg VERSION=${TAG}-debug \ - --build-arg BASE_TAG=${TAG}-debug \ + --build-arg BASE_TAG=${TAG}-debug-$host_arch \ --build-arg VCS_REF=${VCS_REF} \ --build-arg VCS_URL=${VCS_URL} \ --build-arg BUILD_DATE=${BUILD_DATE} \ $script_dir $@ fi if $wasi; then - $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:latest-debug \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:latest-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg BASE_IMAGE=quay.io/itkwasm/wasi-base \ --build-arg VCS_REF=${VCS_REF} \ @@ -135,11 +123,12 @@ if $debug; then --build-arg BUILD_DATE=${BUILD_DATE} \ $script_dir $@ if $version_tag; then - $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:${TAG}-debug \ + $exe $build_cmd --pull=false $tag_flag quay.io/itkwasm/wasi:${TAG}-debug-$host_arch \ --build-arg IMAGE=quay.io/itkwasm/wasi \ + --build-arg HOST_ARCH=$host_arch \ --build-arg CMAKE_BUILD_TYPE=Debug \ --build-arg VERSION=${TAG} \ - --build-arg BASE_TAG=${TAG}-debug \ + --build-arg BASE_TAG=${TAG}-debug-$host_arch \ --build-arg BASE_IMAGE=quay.io/itkwasm/wasi-base \ --build-arg VCS_REF=${VCS_REF} \ --build-arg VCS_URL=${VCS_URL} \ @@ -151,3 +140,23 @@ fi rm -rf ITKWebAssemblyInterfaceModuleCopy median-filter-pipelineCopy + +if $create_manifest; then + for list in quay.io/itkwasm/emscripten:latest \ + quay.io/itkwasm/emscripten:${TAG} \ + quay.io/itkwasm/emscripten:latest-debug \ + quay.io/itkwasm/emscripten:${TAG}-debug \ + quay.io/itkwasm/wasi:latest \ + quay.io/itkwasm/wasi:${TAG} \ + quay.io/itkwasm/wasi:latest-debug \ + quay.io/itkwasm/wasi:${TAG}-debug; do + if $(buildah manifest exists $list); then + buildah manifest rm $list + fi + buildah manifest create $list + buildah pull $list-arm64 + buildah manifest add ${list} docker://${list}-amd64 + + buildah manifest add ${list} docker://${list}-arm64 + done +fi diff --git a/src/docker/itk-wasm/warm-emscripten-cache.sh b/src/docker/itk-wasm/warm-emscripten-cache.sh new file mode 100755 index 000000000..e0669d9c3 --- /dev/null +++ b/src/docker/itk-wasm/warm-emscripten-cache.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -exo pipefail + +if test -n "$EMSCRIPTEN_VERSION"; then + cd /median-filter-pipelineCopy + /usr/local/bin/web-build emscripten-build -DCMAKE_EXE_LINKER_FLAGS='-flto=thin -s DISABLE_EXCEPTION_CATCHING=0' + rm -rf ./web-build + /usr/local/bin/web-build emscripten-build -DCMAKE_EXE_LINKER_FLAGS='-flto -s DISABLE_EXCEPTION_CATCHING=0' + rm -rf ./web-build; /usr/local/bin/web-build emscripten-build -DCMAKE_EXE_LINKER_FLAGS='-fno-lto -s DISABLE_EXCEPTION_CATCHING=1' + rm -rf /median-filter-pipelineCopy + mkdir -p /emsdk/upstream/emscripten/cache/symbol_lists + touch /emsdk/upstream/emscripten/cache/symbol_lists.lock + chmod -R 777 /emsdk/upstream/emscripten/cache +fi diff --git a/src/docker/push.sh b/src/docker/push.sh index 67e94a2fd..2f9e2dbd6 100755 --- a/src/docker/push.sh +++ b/src/docker/push.sh @@ -1,14 +1,19 @@ #!/usr/bin/env bash -script_dir="`cd $(dirname $0); pwd`" -exe=buildah +set -eox pipefail -set -eo pipefail +script_dir="`cd $(dirname $0); pwd`" +source "$script_dir/oci_exe.sh" +exe=$(ociExe) debug=true +push_manifest=false for param; do if [[ $param == '--no-debug' ]]; then debug=false + elif [[ $param == '--push-manifest' ]]; then + push_manifest=true + exe="buildah" else newparams+=("$param") fi @@ -16,6 +21,7 @@ done set -- "${newparams[@]}" # overwrites the original positional params TAG=$(date '+%Y%m%d')-$(git rev-parse --short HEAD) +host_arch=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') if test ! -z ${DOCKERHUB_ITKWasm_PASSWORD+x}; then echo $DOCKERHUB_ITKWasm_PASSWORD | $exe login --username "$DOCKERHUB_ITKWasm_USERNAME" --password-stdin @@ -25,11 +31,25 @@ function push_image() { local image=$1 local tag=$2 local debug=$3 - $exe push quay.io/${image}:${tag} docker://docker.io/${image}:${tag} - $exe push quay.io/${image}:${tag} docker://quay.io/${image}:${tag} + + $exe tag quay.io/${image}:${tag}-${host_arch} docker.io/${image}:${tag}-${host_arch} + $exe push docker.io/${image}:${tag}-${host_arch} + $exe push quay.io/${image}:${tag}-${host_arch} + if $debug; then - $exe push quay.io/${image}:${tag}-debug docker://docker.io/${image}:${tag}-debug - $exe push quay.io/${image}:${tag}-debug docker://quay.io/${image}:${tag}-debug + $exe tag quay.io/${image}:${tag}-debug-${host_arch} docker.io/${image}:${tag}-debug-${host_arch} + $exe push docker.io/${image}:${tag}-debug-${host_arch} + $exe push quay.io/${image}:${tag}-debug-${host_arch} + fi + + if $push_manifest; then + $exe manifest push --all --format v2s2 quay.io/${image}:${tag} docker://docker.io/${image}:${tag} + $exe manifest push --all --format v2s2 quay.io/${image}:${tag} docker://quay.io/${image}:${tag} + + if $debug; then + $exe manifest push --all --format v2s2 quay.io/${image}:${tag}-debug docker://docker.io/${image}:${tag}-debug + $exe manifest push --all --format v2s2 quay.io/${image}:${tag}-debug docker://quay.io/${image}:${tag}-debug + fi fi } @@ -41,3 +61,5 @@ push_image itkwasm/wasi latest ${debug} push_image itkwasm/wasi-base latest ${debug} push_image itkwasm/emscripten latest ${debug} push_image itkwasm/emscripten-base latest ${debug} + +echo "Success." \ No newline at end of file