Skip to content

Commit 70d94d8

Browse files
authored
Merge pull request #72 from FeTS-AI/fixing_docker_build_for_1.0
Fixing docker build for 1.0
2 parents e6163a6 + 25eb0ca commit 70d94d8

8 files changed

Lines changed: 355 additions & 335 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
steps:
3030
- name: Check out the repository
3131
uses: actions/checkout@v3
32-
# with:
32+
with:
3333
# lfs: false
34-
# submodules: 'recursive'
34+
submodules: 'true'
3535

3636
# - name: Check if the repository has changed
3737
# run: ls -l
@@ -53,7 +53,7 @@ jobs:
5353
run: |
5454
echo "Free space:"
5555
df -h
56-
56+
5757
# Install the cosign tool except on PR
5858
# https://github.com/sigstore/cosign-installer
5959
- name: Install cosign
@@ -117,7 +117,9 @@ jobs:
117117
# Run the image from the base entrypoint as a test
118118
- name: Test container with entrypoint
119119
# Run a tag we generated from the metadata extraction above -- they're all the same image, but echo it regardless just so we know.
120-
run: docker run --rm ghcr.io/fets-ai/front-end:latest -h
120+
run: |
121+
docker run --rm ghcr.io/fets-ai/front-end:latest -h
122+
docker run --entrypoint /Front-End/bin/install/appdir/usr/bin/BraTSPipeline ghcr.io/fets-ai/front-end:latest -h
121123
122124
# Push Docker image with Buildx (but don't push on PR)
123125
# https://github.com/docker/build-push-action
@@ -148,4 +150,3 @@ jobs:
148150
# # This step uses the identity token to provision an ephemeral certificate
149151
# # against the sigstore community Fulcio instance.
150152
# run: cosign sign ghcr.io/fets-ai/front-end@${{ steps.upload.outputs.digest }}
151-

CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SET( ${PROJECT_NAME}_Variant "Full" ) # the particular variant of CaPTk (Full/Ne
1313

1414
SET( PROJECT_VERSION_MAJOR 1 )
1515
SET( PROJECT_VERSION_MINOR 0 )
16-
SET( PROJECT_VERSION_PATCH 2 )
16+
SET( PROJECT_VERSION_PATCH 3 )
1717
SET( PROJECT_VERSION_TWEAK )
1818

1919
# check for the string "nonRelease" in the PROJECT_VERSION_PATCH variable
@@ -581,15 +581,15 @@ IF( NOT BUILD_DOCUMENTATION_ONLY )
581581
# copy weights from models
582582
SET( DOWNLOAD_LINK "ftp://www.nitrc.org/home/groups/captk/downloads/models/torch/pt_3dresunet_ss_brainmagebrats_best.pt" )
583583
SET( FILE_TO_EXTRACT "${PROJECT_SOURCE_DIR}/OpenFederatedLearning/bin/federations/weights/pt_3dresunet_ss_brainmagebrats_best.pt")
584-
IF( NOT EXISTS "${FILE_TO_EXTRACT}" )
585-
586-
# download exe from url
587-
MESSAGE( STATUS "Downloading weights for skull stripping" )
588-
FILE(DOWNLOAD "${DOWNLOAD_LINK}" "${FILE_TO_EXTRACT}" TIMEOUT 1000000 STATUS STATUS_CODE SHOW_PROGRESS)
589-
IF(NOT STATUS_CODE EQUAL 0)
590-
MESSAGE(FATAL_ERROR "Failed to download skull-stripping weights. Status=${STATUS_CODE}")
591-
ENDIF()
592-
ENDIF()
584+
# IF( NOT EXISTS "${FILE_TO_EXTRACT}" )
585+
586+
# # download exe from url
587+
# MESSAGE( STATUS "Downloading weights for skull stripping" )
588+
# FILE(DOWNLOAD "${DOWNLOAD_LINK}" "${FILE_TO_EXTRACT}" TIMEOUT 1000000 STATUS STATUS_CODE SHOW_PROGRESS)
589+
# IF(NOT STATUS_CODE EQUAL 0)
590+
# MESSAGE(FATAL_ERROR "Failed to download skull-stripping weights. Status=${STATUS_CODE}")
591+
# ENDIF()
592+
# ENDIF()
593593

594594
# copy network information
595595
## todo: change to a direct installation so that git doesn't get confused that submodule has changed

Dockerfile

Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,74 @@
1-
FROM pytorch/pytorch:1.11.0-cuda11.3-cudnn8-runtime
1+
FROM ghcr.io/fets-ai/fetstool_docker_dependencies:0.0.2.gpu
22

33
LABEL authors="FeTS_Admin <admin@fets.ai>"
44

5-
RUN apt-get update -y
5+
RUN apt-get update && apt-get update --fix-missing && apt-get install -y libnss3 libnspr4 libxcursor1 libxcursor-dev libasound2 libdbus-1-dev libglfw3-dev libgles2-mesa-dev ffmpeg libsm6 libxext6 python3.8 python3.8-venv python3.8-dev python3-setuptools
66

7-
RUN apt-get install wget zip unzip software-properties-common gcc g++ make -y
7+
# older python
8+
RUN apt-get update -y && apt install -y --reinstall software-properties-common && add-apt-repository ppa:deadsnakes/ppa && apt update -y && apt install -y python3.7 python3.7-venv python3.7-dev python3-setuptools
89

9-
RUN apt-get update -y && add-apt-repository ppa:deadsnakes/ppa && apt update -y && apt install python3.7 python3.7-venv python3.7-dev python3-setuptools ffmpeg libsm6 libxext6 -y
10+
ENV PATH=/workspace/CaPTk/bin/qt/5.12.1/bin:/workspace/CaPTk/bin/qt/5.12.1/libexec:$PATH
11+
ENV CMAKE_PREFIX_PATH=/workspace/CaPTk/bin/ITK-build:/workspace/CaPTk/bin/DCMTK-build:/workspace/CaPTk/bin/qt/5.12.1/lib/cmake/Qt5:$CMAKE_PREFIX_PATH
12+
ENV SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True
1013

11-
# We will do git pull on the FeTS_Front-End master, because that is the repo using which the base image is made
12-
# We will not do compiles on the PR because the idea is that the Xenial build will check the build status of
13-
# the PR in any case.
14+
RUN pwd && ls -l
1415

15-
ARG VERSION=0.0.9
16+
WORKDIR /Front-End
1617

17-
# download installer
18-
RUN wget https://fets.projects.nitrc.org/FeTS_${VERSION}_Installer.bin && chmod +x FeTS_${VERSION}_Installer.bin
18+
COPY . .
1919

20-
# install FeTS and remove installer
21-
RUN yes yes | ./FeTS_${VERSION}_Installer.bin --target ./FeTS_${VERSION} -- --cudaVersion 11 && rm -rf ./FeTS_${VERSION}_Installer.bin
20+
RUN pwd && ls -l && mv ./data/Algorithms_for_fetsTool1.0.zip OpenFederatedLearning/submodules/fets_ai/ && cd OpenFederatedLearning/submodules/fets_ai/ && unzip -qq Algorithms_for_fetsTool1.0.zip && rm -rf Algorithms_for_fetsTool1.0.zip
2221

23-
ENV PATH=/workspace/FeTS_${VERSION}/squashfs-root/usr/bin/:$PATH
24-
ENV LD_LIBRARY_PATH=/workspace/FeTS_${VERSION}/squashfs-root/usr/lib/:$LD_LIBRARY_PATH
25-
ENV SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL="True"
22+
RUN pwd && ls -l && mv ./data/GANDLF_for_fetsTool1.0.zip OpenFederatedLearning/submodules/fets_ai/Algorithms && cd OpenFederatedLearning/submodules/fets_ai/Algorithms && unzip -qq GANDLF_for_fetsTool1.0.zip && rm -rf GANDLF_for_fetsTool1.0.zip
23+
24+
## C++ build
25+
RUN mkdir bin && cd bin && cmake -DCMAKE_INSTALL_PREFIX="./install/appdir/usr" -DITK_DIR="/workspace/CaPTk/bin/ITK-build" -DDCMTK_DIR="/workspace/CaPTk/bin/DCMTK-build" -DBUILD_TESTING=OFF .. && make -j$(nproc) && make install/strip
26+
27+
# ## Python package installation -- this is for the new docker image, which is much simpler
28+
# RUN cd bin/install/appdir/usr/bin/ && python3.8 -m venv ./venv && ./venv/bin/pip install --upgrade pip wheel && ./venv/bin/pip install torch==1.13.1+cpu torchvision==0.14.1+cpu torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cpu && ./venv/bin/pip install -e . && ./venv/bin/pip install setuptools-rust Cython scikit-build scikit-learn openvino-dev==2023.0.1 && ./venv/bin/pip install -e .
2629

2730
# set up environment and install correct version of pytorch
28-
RUN cd ./FeTS_${VERSION}/squashfs-root/usr/bin/OpenFederatedLearning && \
31+
RUN echo "Setting up virtual environment for OpenFederatedLearning with base dependencies" && \
32+
cd bin/install/appdir/usr/bin/OpenFederatedLearning && \
2933
rm -rf ./venv && python3.7 -m venv ./venv && ./venv/bin/pip install Cython && \
3034
./venv/bin/pip install --upgrade pip setuptools wheel setuptools-rust && \
31-
./venv/bin/pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html
32-
33-
RUN cd ./FeTS_${VERSION}/squashfs-root/usr/bin/OpenFederatedLearning && \
35+
./venv/bin/pip install torch==1.7.1+cu110 torchvision==0.8.2+cu110 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html && \
3436
./venv/bin/pip install wheel && \
35-
./venv/bin/pip install scikit-build scikit-learn && \
3637
./venv/bin/pip install SimpleITK==1.2.4 && \
3738
./venv/bin/pip install protobuf==3.17.3 grpcio==1.30.0 && \
38-
./venv/bin/pip install opencv-python==4.2.0.34
39-
# ./venv/bin/pip install python-gdcm
40-
41-
RUN cd ./FeTS_${VERSION}/squashfs-root/usr/bin/OpenFederatedLearning && \
42-
./venv/bin/pip install setuptools --upgrade && \
39+
./venv/bin/pip install opencv-python==4.2.0.34 && \
40+
./venv/bin/pip install scikit-build scikit-learn && \
4341
make install_openfl && \
44-
make install_fets && \
45-
./venv/bin/pip install -e ./submodules/fets_ai/Algorithms/GANDLF && \
46-
cd ../LabelFusion && \
47-
rm -rf venv && python3.7 -m venv ./venv && \
42+
make install_openfl_pytorch
43+
44+
RUN echo "Setting up virtual environment for OpenFederatedLearning with second-level dependencies" && \
45+
cd bin/install/appdir/usr/bin/OpenFederatedLearning && \
46+
./venv/bin/pip install ../BrainMaGe && \
47+
./venv/bin/pip install ./submodules/fets_ai/Algorithms && \
48+
./venv/bin/pip install -e ./submodules/fets_ai/Algorithms/GANDLF
49+
50+
RUN echo "Installing separate environment for LabelFusion" && \
51+
cd bin/install/appdir/usr/bin/LabelFusion && \
52+
rm -rf venv && python3.8 -m venv ./venv && \
4853
./venv/bin/pip install --upgrade pip setuptools wheel setuptools-rust && \
4954
./venv/bin/pip install -e .
5055

56+
RUN echo "Downloading model weights" && \
57+
cd bin/install/appdir/usr/data && \
58+
wget https://upenn.box.com/shared/static/f7zt19d08c545qt3tcaeg7b37z6qafum.zip -O nnunet.zip && \
59+
unzip -qq nnunet.zip && rm -rf nnunet.zip && \
60+
wget https://upenn.box.com/shared/static/hhvn8nb9xtz6nxcilmdl8kbx9n1afkdu.zip -O ./fets_consensus_models.zip && \
61+
unzip -qq fets_consensus_models.zip && rm -rf fets_consensus_models.zip
62+
63+
### put together a data example that is already aligned and ready to invoke the brain extraction and tumor segmentation
64+
5165
# set up the docker for GUI
66+
ENV LD_LIBRARY_PATH=/CaPTk/bin/qt/5.12.1/lib:$LD_LIBRARY_PATH
67+
ENV PATH=/Front-End/bin/install/appdir/usr/bin/:$PATH
5268
ENV QT_X11_NO_MITSHM=1
5369
ENV QT_GRAPHICSSYSTEM="native"
5470

5571
RUN echo "Env paths\n" && echo $PATH && echo $LD_LIBRARY_PATH
5672

5773
# define entry point
58-
ENTRYPOINT ["/workspace/FeTS_0.0.9/squashfs-root/usr/bin/FeTS_CLI_Inference"]
74+
ENTRYPOINT ["/Front-End/bin/install/appdir/usr/bin/FeTS_CLI_Segment"]
1.07 MB
Binary file not shown.

data/GANDLF_for_fetsTool1.0.zip

13 MB
Binary file not shown.

0 commit comments

Comments
 (0)