diff --git a/.dockerignore b/.dockerignore index 34e80a172..07db66344 100644 --- a/.dockerignore +++ b/.dockerignore @@ -12,9 +12,8 @@ __pycache__ .idea .vscode - -Dockerfile .webpack +node_modules/ # Environments .env @@ -31,21 +30,5 @@ ubuntu_venv/ sample-apps/*/logs sample-apps/*/train sample-apps/*/model - -# docs build docs/build docs/source/apidocs - -# MONAI-label -*.nii.gz -.DS_Store -*.DS_Store -bin -junit -test-output.xml -studies -tests/data - -# Packages -node_modules -yarn.lock diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1830d5975..107c00b21 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -28,11 +28,21 @@ jobs: MONAI_ZOO_AUTH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 - - name: Build + - name: Cleanup run: | + echo Before Cleanup... + df -h + sudo rm -rf "$AGENT_TOOLSDIRECTORY" rm -rf /opt/hostedtoolcache - docker system prune -f - DOCKER_BUILDKIT=1 docker build -t projectmonai/monailabel:${{ github.event.inputs.tag || 'latest' }} -f Dockerfile . + rm -rf /usr/share/dotnet/ + cd /opt + find . -maxdepth 1 -mindepth 1 '!' -path ./containerd '!' -path ./actionarchivecache '!' -path ./runner '!' -path ./runner-cache -exec rm -rf '{}' ';' + cd - + echo After Cleanup... + df -h + - name: Build + run: | + DOCKER_BUILDKIT=0 docker build -t projectmonai/monailabel:${{ github.event.inputs.tag || 'latest' }} -f Dockerfile . - name: Verify run: | docker run --rm -i --ipc=host --net=host -v $(pwd):/workspace projectmonai/monailabel:${{ github.event.inputs.tag || 'latest' }} /workspace/runtests.sh --net diff --git a/Dockerfile b/Dockerfile index 1befe0c53..f47e9137a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,28 +11,32 @@ # To build with a different base image # please run `./runtests.sh --clean && DOCKER_BUILDKIT=1 docker build -t projectmonai/monailabel:latest .` -# to use different version of MONAI pass `--build-arg MONAI_IMAGE=...` +# to use different version of MONAI pass `--build-arg FINAL_IMAGE=...` -ARG MONAI_IMAGE=projectmonai/monai:1.4.0 +#ARG FINAL_IMAGE=pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime +ARG FINAL_IMAGE=ubuntu:22.04 +ARG BUILD_IMAGE=python:3.10 ARG NODE_IMAGE=node:slim +# Phase1: Build OHIF Viewer FROM ${NODE_IMAGE} AS ohifbuild -ADD ./plugins/ohifv3 /opt/ohifv3 +COPY plugins/ohifv3 /opt/ohifv3 RUN apt update -y && apt install -y git RUN cd /opt/ohifv3 && ./build.sh /opt/ohifv3/release -FROM ${MONAI_IMAGE} AS build -LABEL maintainer="monai.contact@gmail.com" - +# Phase2: Build MONAI Label Package +FROM ${BUILD_IMAGE} AS build +WORKDIR /opt/monailabel +RUN python -m pip install pip setuptools wheel twine ADD . /opt/monailabel/ COPY --from=ohifbuild /opt/ohifv3/release /opt/monailabel/monailabel/endpoints/static/ohif -RUN python -m pip install --upgrade --no-cache-dir pip setuptools wheel twine \ - && cd /opt/monailabel \ - && BUILD_OHIF=false python setup.py sdist bdist_wheel --build-number $(date +'%Y%m%d%H%M') +RUN BUILD_OHIF=false python setup.py bdist_wheel --build-number $(date +'%Y%m%d%H%M') -FROM ${MONAI_IMAGE} +# Phase3: Build Final Docker +FROM ${FINAL_IMAGE} LABEL maintainer="monai.contact@gmail.com" - +WORKDIR /opt/monailabel +RUN apt update -y && apt install -y git curl openslide-tools python3 python-is-python3 python3-pip +RUN python -m pip install --no-cache-dir pytest torch torchvision torchaudio COPY --from=build /opt/monailabel/dist/monailabel* /opt/monailabel/dist/ -RUN python -m pip install --upgrade --no-cache-dir pip \ - && python -m pip install /opt/monailabel/dist/monailabel*.whl +RUN python -m pip install --no-cache-dir /opt/monailabel/dist/monailabel*.whl diff --git a/docs/images/dsa.jpg b/docs/images/dsa.jpg index 696763273..bfbbf741d 100644 Binary files a/docs/images/dsa.jpg and b/docs/images/dsa.jpg differ diff --git a/docs/images/quickstart/monai-label-plugin-favorite-modules-1.png b/docs/images/quickstart/monai-label-plugin-favorite-modules-1.png index 41919275a..d80e55b57 100644 Binary files a/docs/images/quickstart/monai-label-plugin-favorite-modules-1.png and b/docs/images/quickstart/monai-label-plugin-favorite-modules-1.png differ diff --git a/docs/images/qupath.jpg b/docs/images/qupath.jpg index 4d493a8fe..4525a1049 100644 Binary files a/docs/images/qupath.jpg and b/docs/images/qupath.jpg differ diff --git a/docs/images/sample-apps/deepedit_brain_tumor.png b/docs/images/sample-apps/deepedit_brain_tumor.png deleted file mode 100644 index ecb476635..000000000 Binary files a/docs/images/sample-apps/deepedit_brain_tumor.png and /dev/null differ diff --git a/docs/images/sample-apps/deepedit_left_atrium.png b/docs/images/sample-apps/deepedit_left_atrium.png deleted file mode 100644 index d4f15730c..000000000 Binary files a/docs/images/sample-apps/deepedit_left_atrium.png and /dev/null differ diff --git a/docs/images/sample-apps/deepedit_left_ventricle.png b/docs/images/sample-apps/deepedit_left_ventricle.png deleted file mode 100644 index 7fc509fbd..000000000 Binary files a/docs/images/sample-apps/deepedit_left_ventricle.png and /dev/null differ diff --git a/docs/images/sample-apps/deepedit_lungs.png b/docs/images/sample-apps/deepedit_lungs.png deleted file mode 100644 index 5ce16a961..000000000 Binary files a/docs/images/sample-apps/deepedit_lungs.png and /dev/null differ diff --git a/docs/images/sample-apps/deepedit_spleen.png b/docs/images/sample-apps/deepedit_spleen.png deleted file mode 100644 index fdbd5ab7c..000000000 Binary files a/docs/images/sample-apps/deepedit_spleen.png and /dev/null differ diff --git a/docs/images/sample-apps/deepedit_vertebra.png b/docs/images/sample-apps/deepedit_vertebra.png deleted file mode 100644 index 4e78b3478..000000000 Binary files a/docs/images/sample-apps/deepedit_vertebra.png and /dev/null differ diff --git a/docs/images/sample-apps/segmentation_heart_ventricles.png b/docs/images/sample-apps/segmentation_heart_ventricles.png deleted file mode 100644 index 75bbd3a41..000000000 Binary files a/docs/images/sample-apps/segmentation_heart_ventricles.png and /dev/null differ diff --git a/runtests.sh b/runtests.sh index 11667af7d..1f7cabc5f 100755 --- a/runtests.sh +++ b/runtests.sh @@ -137,9 +137,11 @@ function clean_py() { rm -rf tests/data/* rm -rf build rm -rf dist + rm -rf monailabel.egg-info + rm -rf .eggs + rm -rf .mypy_cache - find sample-apps -type d -name "__pycache__" -exec rm -rf "{}" + - find monailabel -type d -name "__pycache__" -exec rm -rf "{}" + + find . -type d -name "__pycache__" -exec rm -rf "{}" + find plugins -type d -name "node_modules" -exec rm -rf "{}" + } diff --git a/setup.py b/setup.py index 9189ff7ab..aa4af4408 100755 --- a/setup.py +++ b/setup.py @@ -27,12 +27,14 @@ def recursive_files(directory, prefix): filenames = [f for f in filenames if f != ".gitignore"] for filename in filenames: paths.append(os.path.join(path, filename)) + print(f"Total Items in path: {directory} are {len(paths)}") return [(os.path.dirname(prefix + os.path.sep + p), [p]) for p in paths] data_files = [("logconfig", ["monailabel/logging.json"])] data_files.extend(recursive_files("sample-apps", "monailabel")) data_files.extend(recursive_files("plugins", "monailabel")) +print(f"Total Data Files: {len(data_files)}") # Build OHIF Plugin build_ohif_s = os.environ.get("BUILD_OHIF", "false")