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 https://shanoir.org 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,
Michael
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 (https://docs.ohif.org/deployment/recipes/build-for-production.html):
#
# 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/ohif_viewer_dist.zip .
#
# 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
ARG OHIF_VIEWER_REV=4.9.8
RUN apt update && apt upgrade -y
RUN apt install -y curl gnupg2 unzip zip
#RUN curl -L https://github.com/OHIF/Viewers/archive/master.zip -o ohif_viewer.zip && unzip ohif_viewer.zip
RUN curl -L https://github.com/OHIF/Viewers/archive/@ohif/viewer@${OHIF_VIEWER_REV}.zip -o ohif_viewer.zip && unzip ohif_viewer.zip
# Install yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ 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,
Michael