Docker with OHIF viewer 2 - stable required

Dear developers of the OHIF viewer,

congratulations to your great tool!

I am working on an imaging platform called Shanoir, for SHAring NeurOImaging Resources, please see and GitHub - fli-iam/shanoir-ng: Shanoir, next generation, based on microservices architecture for more information.

I try to integrate your viewer as a potential new viewer for our web tool.
As we are docker-based, your latest public docker image on dockerhub seems to be version 1.0, what feels quite out-dated. Do you have a docker image of version 2.0? or v3.0 latest dev?

Following the Build for production guidelines of v2.0, I implemented all steps into my Dockerfile, that is based on node-js-alpine linux docker image, but I struggle to finish the “yarn run build” as I have that error in the end:

gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/Viewers-master/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:390:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)

Thank you for your help and with kind regards,

Hi, Michael,

I used the following Docker file to build OHIF Viewer v2.x (actually a 4.x version from the Viewers github project). I have comments at the top for grabbing the build artifacts out if you want to serve the viewer from a plain old web server.

# Build OHIF for production (
# export OHIF_VIEWER_REV=4.9.20
# docker build -t --build-arg OHIF_VIEWER_REV=${OHIF_VIEWER_REV} jenseninformatics/ohif-viewer:${OHIF_VIEWER_REV} .
# Copy production build artifacts:
# docker run --rm --name ohif-viewer -it jenseninformatics/ohif-viewer:${OHIF_REV} /bin/bash
# [in another shell] docker cp ohif-viewer:/tmp/ .
# Server production build locally:
# docker run --rm -it -p8090:8080 jenseninformatics/ohif-viewer:${OHIF_VIEWER_REV} /bin/bash -c "cd /Viewers--ohif-viewer-${OHIF_REV}/platform/viewer/dist && /usr/local/bin/http-server"
# docker run --rm -it -p3000:3000 jenseninformatics/ohif-viewer:${OHIF_VIEWER_REV} /bin/bash -c "cd /Viewers--ohif-viewer-${OHIF_REV} && yarn run dev"
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && apt upgrade -y
RUN apt install -y curl gnupg2 unzip zip
#RUN curl -L -o && unzip
RUN curl -L${OHIF_VIEWER_REV}.zip -o && unzip

# Install yarn
RUN curl -sS | apt-key add -
RUN echo "deb stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt update && apt install -y yarn nodejs
RUN yarn --version

# Make working directory the source directory
WORKDIR /Viewers--ohif-viewer-${OHIF_VIEWER_REV}

# Now run production build
RUN yarn config set workspaces-experimental true
RUN yarn install
RUN yarn run build

# Local testing accessible at http://localhost:8080
RUN yarn global add http-server
CMD "/usr/local/bin/http-server" "/Viewers--ohif-viewer-${OHIF_VIEWER_REV}/platform/viewer/dist"

Todd Jensen, PhD
Jensen Informatics LLC

Hi Todd,

thank you a lot! I will have a look on your Dockerfile with pleasure.
I recognise already, that you are using Ubuntu as base image, what
should make the difference already, I guess.

Thank you again and have a nice day,