Spaces:
Paused
Paused
| FROM nvidia/cuda:12.2.2-cudnn8-devel-ubuntu22.04 as base | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| TZ=America/Los_Angeles | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| make build-essential libssl-dev zlib1g-dev \ | |
| libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ | |
| libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev git-lfs \ | |
| cmake-curses-gui cmake libinsighttoolkit4-dev libfftw3-dev libvtk7-dev \ | |
| ffmpeg libsm6 libxext6 cmake libgl1-mesa-glx lsof \ | |
| orthanc orthanc-dicomweb vim \ | |
| nginx \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git lfs install | |
| # install plastimatch | |
| RUN git clone https://gitlab.com/plastimatch/plastimatch && cd plastimatch && mkdir build && cd build && cmake .. && make -j$(nproc) && make install | |
| WORKDIR /code | |
| COPY ./requirements.txt /code/requirements.txt | |
| # User | |
| RUN useradd -m -u 1000 user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| USER user | |
| # Pyenv | |
| RUN curl https://pyenv.run | bash | |
| ENV PATH=$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH | |
| ARG PYTHON_VERSION=3.10.13 | |
| # Python | |
| RUN pyenv install $PYTHON_VERSION && \ | |
| pyenv global $PYTHON_VERSION && \ | |
| pyenv rehash && \ | |
| pip install --no-cache-dir --upgrade pip setuptools wheel && \ | |
| pip install --no-cache-dir \ | |
| datasets \ | |
| huggingface-hub "protobuf<4" "click<8.1" | |
| RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
| # Set the working directory to /data if USE_PERSISTENT_DATA is set, otherwise set to $HOME/app | |
| WORKDIR $HOME/app | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONPATH=$HOME/app \ | |
| PYTHONUNBUFFERED=1 | |
| RUN monailabel apps --name radiology --download --output apps | |
| RUN monailabel datasets --download --name Task09_Spleen --output datasets | |
| # build ohifv3 viewer | |
| FROM node:18.16.1-slim as builder | |
| RUN apt-get update && apt-get install -y build-essential yarn git && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /code | |
| RUN git clone https://github.com/Project-MONAI/MONAILabel.git . | |
| WORKDIR /code/plugins/ohifv3 | |
| COPY build-ohfiv3.sh monai_label.js /code/plugins/ohifv3/ | |
| RUN ./build-ohfiv3.sh | |
| # RUN monailabel datasets --download --name Task01_BrainTumour --output datasets | |
| # RUN monailabel datasets --download --name Task09_Spleen --output . | |
| # RUN plastimatch convert --patient-id patient1 --input Task09_Spleen/imagesTs/spleen_1.nii.gz --output-dicom dicom_output | |
| # monailabel start_server --app apps/radiology --studies http://127.0.0.1:8042/dicom-web --conf models deepedit | |
| # CMD ["monailabel", "start_server", "--app", "apps/radiology", "--studies", "http://0.0.0.0:8042/dicom-web", "--conf" , "models", "deepedit"] | |
| # CMD ["monailabel", "start_server", "--app", "apps/radiology", "--studies", "datasets/Task01_BrainTumour/imagesTr", "--conf" , "models", "deepedit"] | |
| # /etc/orthanc/orthanc.json -> "RemoteAccessAllowed": false, -> "RemoteAccessAllowed": true, | |
| # RUN sed -i 's/"RemoteAccessAllowed" : false,/"RemoteAccessAllowed" : true,/g' /etc/orthanc/orthanc.json | |
| FROM base as final | |
| USER root | |
| RUN mkdir -p /var/cache/orthanc /var/log/orthanc /var/lib/orthanc && \ | |
| chown -R user:user /var/cache/orthanc /var/log/orthanc /usr/share/orthanc/ /var/lib/orthanc /etc/orthanc && \ | |
| mkdir -p /var/cache/nginx /var/log/nginx /var/lib/nginx && \ | |
| touch /var/run/nginx.pid && \ | |
| chown -R user:user /var/cache/nginx /var/log/nginx /var/lib/nginx /var/run/nginx.pid | |
| COPY --chown=user orthanc.json /etc/orthanc/orthanc.json | |
| COPY --chown=user nginx.conf /etc/nginx/sites-available/default | |
| COPY --from=builder --chown=user /code/plugins/ohifv3/Viewers/platform/app/dist/ /usr/share/nginx/html | |
| USER user | |
| COPY --chown=user run.sh . | |
| CMD ["sh", "run.sh"] | |
| # monailabel start_server --app apps/radiology --studies datasets/Task01_BrainTumour/imagesTr --conf models deepedit |