diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..430c241b7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +.idea/ +.meteor/local +.meteor/meteorite +.meteor/dev_bundle +*/.meteor/dev_bundle +node_modules +.npm +npm-debug.log +Packages/active-entry/helloworld/ +LesionTracker/tests/nightwatch/reports/ +package-lock.json +docs/_book +docs/ +img/ +test/ +LesionTracker/ +StandaloneViewer/ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..dc36e8b08 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.6' +services: + mongo: + image: "mongo:latest" + ports: + - "27017:27017" + + viewer: + #image: ohifviewer:latest + build: . + ports: + - "3000:3000" + links: + - mongo + env_file: dockersupport/ohifviewer.env # TODO: Doesn't look like METEOR Settings are being used properly? + environment: + - MONGO_URL=mongodb://mongo:27017/ohif + extra_hosts: + - "localpacs:192.168.1.11" \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 000000000..bbd8e20a8 --- /dev/null +++ b/dockerfile @@ -0,0 +1,50 @@ +# First stage of multi-stage build +# Installs Meteor and builds node.js version +# This stage is named 'builder' +# The data for this intermediary image is not included +# in the final image. +FROM node:8.10.0-slim as builder + +RUN apt-get update && apt-get install -y \ + curl \ + g++ \ + build-essential + +RUN curl https://install.meteor.com/ | sh + +# Create a non-root user +RUN useradd -ms /bin/bash user +USER user +ADD --chown=user:user . /home/user/Viewers + +WORKDIR /home/user/Viewers/OHIFViewer + +RUN meteor npm install +ENV METEOR_PACKAGE_DIRS=../Packages +RUN meteor build --directory /home/user/app +WORKDIR /home/user/app/bundle/programs/server +RUN npm install --production + +# Second stage of multi-stage build +# Creates a slim production image for the node.js application +# +# TODO: Switch to node:8.10.0-alpine for size purposes. I was getting Segmentation Faults from the node +# process. There are probably some minor changes to be made to ensure it works. +FROM node:8.10.0-slim + +WORKDIR /app +COPY --from=builder /home/user/app . + +RUN npm install -g pm2 + +ADD dockersupport/app.json . + +ENV ROOT_URL http://localhost:3000 +ENV PORT 3000 +ENV NODE_ENV development + +EXPOSE 3000 + +WORKDIR /app +CMD ["pm2-runtime", "app.json"] + diff --git a/dockersupport/app.json b/dockersupport/app.json new file mode 100644 index 000000000..bae41f8ec --- /dev/null +++ b/dockersupport/app.json @@ -0,0 +1,9 @@ +{ + "apps" : [{ + "name" : "ohif-viewer", + "script" : "main.js", + "watch" : true, + "merge_logs" : true, + "cwd" : "/app/bundle/" + }] +} \ No newline at end of file diff --git a/dockersupport/ohifviewer.env b/dockersupport/ohifviewer.env new file mode 100644 index 000000000..0d911fe8d --- /dev/null +++ b/dockersupport/ohifviewer.env @@ -0,0 +1,36 @@ +METEOR_SETTINGS = "{ + "servers": { + "dicomWeb": [ + { + "name": "Orthanc", + "wadoUriRoot": "http://localpacs:8042/wado", + "qidoRoot": "http://localpacs:8042/dicom-web", + "wadoRoot": "http://localpacs:8042/dicom-web", + "qidoSupportsIncludeField": false, + "imageRendering": "wadouri", + "thumbnailRendering": "wadors", + "requestOptions": { + "auth": "orthanc:orthanc", + "logRequests": true, + "logResponses": false, + "logTiming": true + } + } + ] + }, + "defaultServiceType": "dicomWeb", + "dropCollections": true, + "public": { + "verifyEmail": false, + "ui": { + "studyListFunctionsEnabled": true, + "leftSidebarOpen": false, + "displaySetNavigationLoopOverSeries": false, + "displaySetNavigationMultipleViewports": true, + "autoPositionMeasurementsTextCallOuts": "TRLB" + } + }, + "proxy": { + "enabled": true + } +}"