Skip to content

Commit 90b6e67

Browse files
committed
build: re-use ITK, DCMTK source locations in native, docker builds
Also add the ability to drive via pixi.
1 parent 859414a commit 90b6e67

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ packages/transform-io/typescript/demo-app/
102102
*.egg-info
103103

104104
native/
105-
105+
src/docker/itk-wasm-base/itk_wasm_env_vars.sh

docs/development/hacking_itk_wasm.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ To pull the `latest` the build environment Docker images,
6969
To build the `latest` build environment Docker images from the Docker configuration and local C++ core,
7070

7171
```sh
72-
./src/docker/build.sh --with-debug
72+
pixi run build-docker-images --with-debug
7373
```
7474

7575
The `--with-debug` flag will also build the `latest-debug` tagged images.
@@ -242,4 +242,4 @@ and rebuild whenever the documentation changes.
242242
[standard GitHub contribution best practices]: https://docs.itk.org/en/latest/contributing/index.html
243243
[web3.storage]: https://web3.storage/
244244
[Windows Git Bash]: https://gitforwindows.org/
245-
[WSL]: https://learn.microsoft.com/en-us/windows/wsl/install
245+
[WSL]: https://learn.microsoft.com/en-us/windows/wsl/install

itk_wasm_env.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function die() {
55
exit 1
66
}
77

8-
if [$OSTYPE == "cygwin"] || [$OSTYPE == "msys"] || [$OSTYPE =="win32"]; then
8+
if test "$OSTYPE" = "cygwin" || test "$OSTYPE" = "msys" || test "$OSTYPE" = "win32"; then
99
echo "Windows platform detected ... adding \"/Zc:__cplusplus /DNOMINMAX\" to \$CXXFLAGS"
1010
export CXXFLAGS="/Zc:__cplusplus /DNOMINMAX"
1111
fi
@@ -27,4 +27,4 @@ export ITK_WASM_DICOM_TEST_DATA_HASH=${ITK_WASM_DICOM_TEST_DATA_HASH:-$(cat pack
2727
export ITK_WASM_DICOM_TEST_DATA_URLS=${ITK_WASM_DICOM_TEST_DATA_URLS:-$(cat packages/dicom/package.json | jq -e -r '."itk-wasm"."test-data-urls" | join(" ")')}
2828

2929
export ITK_WASM_MESH_IO_TEST_DATA_HASH=${ITK_WASM_MESH_IO_TEST_DATA_HASH:-$(cat packages/mesh-io/package.json | jq -e -r '."itk-wasm"."test-data-hash"')}
30-
export ITK_WASM_MESH_IO_TEST_DATA_URLS=${ITK_WASM_MESH_IO_TEST_DATA_URLS:-$(cat packages/mesh-io/package.json | jq -e -r '."itk-wasm"."test-data-urls" | join(" ")')}
30+
export ITK_WASM_MESH_IO_TEST_DATA_URLS=${ITK_WASM_MESH_IO_TEST_DATA_URLS:-$(cat packages/mesh-io/package.json | jq -e -r '."itk-wasm"."test-data-urls" | join(" ")')}

pixi.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ depends-on = ["pnpm-install"]
2929
outputs = ["packages/mesh-io/test/data.tar.gz"]
3030
description = "Download mesh-io test data"
3131

32+
[tasks.export-itk-wasm-env-vars]
33+
cmd = "bash -c ./itk_wasm_env.bash && env | grep ITK_WASM | grep -v TEST > ./src/docker/itk-wasm-base/itk_wasm_env_vars.sh"
34+
outputs = ["src/docker/itk-wasm-base/itk_wasm_env_vars.*"]
35+
inputs = ["itk_wasm_env.*"]
36+
description = "Provide ITK_WASM environmental variables to the Docker image"
37+
38+
[tasks.update-default-image-tag]
39+
cmd = "sed -i \"s/const defaultImageTag = '.*'/const defaultImageTag = '$new_tag'/g\" packages/core/typescript/itk-wasm/src/cli/default-image-tag.js"
40+
outputs = ["packages/core/typescript/itk-wasm/src/cli/default-image-tag.*"]
41+
description = "Update the default Docker image tag"
42+
43+
[tasks.build-docker-images]
44+
cmd = "src/docker/build.sh"
45+
description = "Build the ITK-Wasm docker images"
46+
depends-on = ["clean", "export-itk-wasm-env-vars", "update-default-image-tag"]
47+
3248
[dependencies]
3349
pnpm = ">=9.7.1,<10"
3450
nodejs = ">=22.6.0,<23"

src/docker/itk-wasm-base/Dockerfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ LABEL org.opencontainers.image.source="https://github.com/InsightSoftwareConsort
77

88
WORKDIR /
99

10+
COPY itk_wasm_env_vars.sh /
11+
1012
# Note: on entry, emsdk will prepend to the path with its own node, so add to an earlier path
1113
ENV NODE_TAG v20.12.2
1214
RUN curl -LO https://nodejs.org/dist/${NODE_TAG}/node-${NODE_TAG}-linux-x64.tar.xz && \
@@ -33,19 +35,16 @@ RUN curl -L https://github.com/api/repos/facebook/zstd/tarball/${zstd_GIT_TAG} |
3335
cd .. && \
3436
rm -rf zstd-build zstd
3537

36-
# tag commit date: 2024-08-16
37-
ENV ITK_GIT_TAG eddb514e52a23e2b0987b71fda59780c6ad209ab
38-
ENV ITK_GIT_BRANCH itkwasm-2024-05-20-5db055d7ad3b-3
39-
RUN git clone --branch $ITK_GIT_BRANCH --single-branch --depth 1 https://github.com/KitwareMedical/ITK.git && \
38+
RUN . /itk_wasm_env_vars.sh && git clone --branch $ITK_WASM_ITK_BRANCH --single-branch --depth 1 $ITK_WASM_ITK_REPOSITORY && \
4039
sed -i -e '/^option(OPJ_USE_THREAD/c\option(OPJ_USE_THREAD "use threads" OFF)' \
4140
/ITK/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt
4241

4342
# Modify CMake variable to use patched DCMTK library
4443
# GIT_TAG refers to DCMTK branch: 20240311_DCMTK_PATCHES_FOR_ITK-Wasm-1
45-
RUN sed -i -e '/^set(DCMTK_GIT_REPOSITORY/c\set(DCMTK_GIT_REPOSITORY "https://github.com/InsightSoftwareConsortium/DCMTK.git")' \
44+
RUN . /itk_wasm_env_vars.sh && sed -i -e "/^set(DCMTK_GIT_REPOSITORY/c\set(DCMTK_GIT_REPOSITORY \"${ITK_WASM_DCMTK_REPOSITORY}\")" \
4645
/ITK/Modules/ThirdParty/DCMTK/DCMTKGitTag.cmake
4746

48-
RUN sed -i -e '/^set(DCMTK_GIT_TAG/c\set(DCMTK_GIT_TAG "93e6d1b20b476c388f0379245c8c6e96af7f16f4")' \
47+
RUN . /itk_wasm_env_vars.sh && sed -i -e "/^set(DCMTK_GIT_TAG/c\set(DCMTK_GIT_TAG \"${ITK_WASM_DCMTK_GIT_TAG}\")" \
4948
/ITK/Modules/ThirdParty/DCMTK/DCMTKGitTag.cmake
5049

5150
RUN if test -e $WASI_SDK_PATH/share/cmake/wasi-sdk.cmake; then sed -i '/cmake_minimum_required/d' $WASI_SDK_PATH/share/cmake/wasi-sdk.cmake; fi

0 commit comments

Comments
 (0)