Build individual plugins using the Orthanc builder and mount as a volume

Hi all!

I am playing around with the Orthanc builder and wanted to know if I can build a specific plugin, like OHIF plugin or Orthanc explorer 2 plugin, get the .sso build file and mount it as a Docker volume to the orthanc container?

Hi,

You may extract the relevant information from the Orthanc builder repo. e.g, for OE2, you would end up with this Dockerfile that you can save at the root of your OE2 folder:

FROM osimis/orthanc-builder-base:bullseye-20230814-slim-unstable as build-oe2


COPY . /sources/orthanc-explorer-2/


RUN DEBIAN_FRONTEND=noninteractive && apt-get --assume-yes update && apt-get --assume-yes install npm && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN curl -fsSL https://deb.nodesource.com/setup_19.x | bash - && apt-get install -y nodejs

WORKDIR /sources/orthanc-explorer-2/WebApplication

RUN npm install
RUN npm run build

WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF -DPLUGIN_VERSION=0.0.0 /sources/orthanc-explorer-2/
RUN make -j 4


FROM osimis/orthanc:23.8.2

COPY --from=build-oe2 /build/libOrthancExplorer2.so /usr/share/orthanc/plugins-available/

Then, run docker build -t osimis/orthanc:with-my-oe2 .

HTH,

Alain

Hi Alain, thanks for the response,

Are you creating this Dockerfile using the docker/orthanc/Dockerfile and the build-or-download.sh?

Also, it would be awesome if you could share the same Dockerfile setup for the OHIF plugin.

Regards,
Yash

Well, it’s a self contained Dockerfile inspired by build-or-download.sh


Here’s one for OHIF to build the today’s OHIF beta.

Copy this content into a Dockerfile at the root of the orthanc-ohif repo

FROM osimis/orthanc-builder-base:bullseye-20230814-slim-unstable as build-plugin-ohif


COPY . /sources


RUN DEBIAN_FRONTEND=noninteractive && apt-get --assume-yes update && apt-get --assume-yes install npm && apt-get clean && rm -rf /var/lib/apt/lists/*

RUN DEBIAN_FRONTEND=noninteractive && \
            mkdir -p /etc/apt/keyrings && \
            curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
            echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
            apt-get update && apt-get install --assume-yes nodejs
RUN npm install --global yarn

WORKDIR /sources

RUN wget https://github.com/OHIF/Viewers/archive/refs/tags/v3.7.0-beta.75.tar.gz --quiet --output-document /sources/Viewers-3.7.0-beta.75.tar.gz

RUN mkdir /target
RUN mkdir /source

RUN cp -r /sources/* /source
RUN chmod +x /source/Resources/CreateOHIFDist/build.sh
RUN /source/Resources/CreateOHIFDist/build.sh Viewers-3.7.0-beta.75
RUN mkdir -p /sources/OHIF
RUN cp -r /target /sources/OHIF/dist

WORKDIR /build
RUN cmake -DALLOW_DOWNLOADS=ON -DCMAKE_BUILD_TYPE:STRING=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF /sources
RUN make -j 4


FROM osimis/orthanc:23.8.2

COPY --from=build-plugin-ohif /build/libOrthancOHIF.so /usr/share/orthanc/plugins-available/

Simply run docker build --progress=plain -t osimis/orthanc:with-my-ohif .

HTH,

Alain.

1 Like