From 3ce72254b390f32c9aa207a0589e688805e2659d Mon Sep 17 00:00:00 2001 From: Joe Boccanfuso <109477394+jbocce@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:05:36 -0400 Subject: [PATCH] fix(nginx archive recipe): Fixes to various configuration files. (#3624) Co-authored-by: Alireza --- .dockerignore | 7 ++++ .../OpenResty-Orthanc-Keycloak/.dockerignore | 16 -------- .../docker-compose.yml | 6 +-- .../OpenResty-Orthanc-Keycloak/dockerfile | 13 ++++--- .../.recipes/OpenResty-Orthanc/.dockerignore | 16 -------- .../OpenResty-Orthanc/config/nginx.conf | 2 + .../OpenResty-Orthanc/docker-compose.yml | 2 +- .../app/.recipes/OpenResty-Orthanc/dockerfile | 23 +++++------- .../docker_openresty-orthanc-keycloak.js | 37 +++++++++++-------- .../public/config/docker_openresty-orthanc.js | 13 +++++-- .../docs/deployment/nginx--image-archive.md | 2 +- 11 files changed, 63 insertions(+), 74 deletions(-) delete mode 100644 platform/app/.recipes/OpenResty-Orthanc-Keycloak/.dockerignore delete mode 100644 platform/app/.recipes/OpenResty-Orthanc/.dockerignore diff --git a/.dockerignore b/.dockerignore index d4a539c50d9..ca74c539884 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,12 @@ # Reduces size of context and hides # files from Docker (can't COPY or ADD these) +# Note that typically the Docker context for various OHIF containers is the +# directory of this file (i.e. the root of the source). As such, this is +# the .dockerignore file for ALL Docker containers that are built. For example, +# the Docker containers built from the recipes in ./platform/app/.recipes will +# have this file as their .dockerignore. + # Output dist/ build/ @@ -28,3 +34,4 @@ dockerfile .vscode/ coverage/ docs/ +testdata/ diff --git a/platform/app/.recipes/OpenResty-Orthanc-Keycloak/.dockerignore b/platform/app/.recipes/OpenResty-Orthanc-Keycloak/.dockerignore deleted file mode 100644 index 67f1b2e985c..00000000000 --- a/platform/app/.recipes/OpenResty-Orthanc-Keycloak/.dockerignore +++ /dev/null @@ -1,16 +0,0 @@ -# Output -dist/ - -# Dependencies -node_modules/ - -# Root -README.md -Dockerfile - -# Misc. Config -.git -.DS_Store -.gitignore -.vscode -.circleci diff --git a/platform/app/.recipes/OpenResty-Orthanc-Keycloak/docker-compose.yml b/platform/app/.recipes/OpenResty-Orthanc-Keycloak/docker-compose.yml index 771737f3cfe..f3c0da26526 100644 --- a/platform/app/.recipes/OpenResty-Orthanc-Keycloak/docker-compose.yml +++ b/platform/app/.recipes/OpenResty-Orthanc-Keycloak/docker-compose.yml @@ -10,9 +10,9 @@ services: ohif_viewer: build: # Project root - context: ./../../ + context: ./../../../../ # Relative to context - dockerfile: ./docker/OpenResty-Orthanc-Keycloak/dockerfile + dockerfile: ./platform/app/.recipes/OpenResty-Orthanc-Keycloak/dockerfile image: webapp:latest container_name: webapp volumes: @@ -35,7 +35,7 @@ services: # TODO: Update to use Postgres # https://github.com/mrts/docker-postgresql-multiple-databases orthanc: - image: jodogne/orthanc-plugins:1.5.6 + image: jodogne/orthanc-plugins hostname: orthanc container_name: orthanc volumes: diff --git a/platform/app/.recipes/OpenResty-Orthanc-Keycloak/dockerfile b/platform/app/.recipes/OpenResty-Orthanc-Keycloak/dockerfile index 73090e8ae19..490e8f35024 100644 --- a/platform/app/.recipes/OpenResty-Orthanc-Keycloak/dockerfile +++ b/platform/app/.recipes/OpenResty-Orthanc-Keycloak/dockerfile @@ -23,7 +23,7 @@ # Stage 1: Build the application -FROM node:11.2.0-slim as builder +FROM node:16.15.0-slim as builder RUN mkdir /usr/src/app WORKDIR /usr/src/app @@ -31,12 +31,15 @@ WORKDIR /usr/src/app ENV APP_CONFIG=config/docker_openresty-orthanc-keycloak.js ENV PATH /usr/src/app/node_modules/.bin:$PATH -COPY package.json /usr/src/app/package.json -COPY yarn.lock /usr/src/app/yarn.lock +# Copy all files from the root of the OHIF source and note +# that the Docker ignore file at the root (i.e. ./dockerignore) will filter +# out files and directories that are not needed. +COPY ./ /usr/src/app/ ADD . /usr/src/app/ +RUN yarn config set workspaces-experimental true RUN yarn install -RUN yarn run build:web +RUN yarn run build # Stage 2: Bundle the built application into a Docker container # which runs openresty (nginx) using Alpine Linux @@ -60,6 +63,6 @@ RUN luarocks install lua-resty-openidc RUN luarocks install luacrypto # Copy build output to image -COPY --from=builder /usr/src/app/build /var/www/html +COPY --from=builder /usr/src/app/platform/app/dist /var/www/html ENTRYPOINT ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"] diff --git a/platform/app/.recipes/OpenResty-Orthanc/.dockerignore b/platform/app/.recipes/OpenResty-Orthanc/.dockerignore deleted file mode 100644 index 67f1b2e985c..00000000000 --- a/platform/app/.recipes/OpenResty-Orthanc/.dockerignore +++ /dev/null @@ -1,16 +0,0 @@ -# Output -dist/ - -# Dependencies -node_modules/ - -# Root -README.md -Dockerfile - -# Misc. Config -.git -.DS_Store -.gitignore -.vscode -.circleci diff --git a/platform/app/.recipes/OpenResty-Orthanc/config/nginx.conf b/platform/app/.recipes/OpenResty-Orthanc/config/nginx.conf index 777e4970364..aff59a13027 100644 --- a/platform/app/.recipes/OpenResty-Orthanc/config/nginx.conf +++ b/platform/app/.recipes/OpenResty-Orthanc/config/nginx.conf @@ -118,6 +118,8 @@ http { index index.html; try_files $uri $uri/ /index.html; add_header Cache-Control "no-store, no-cache, must-revalidate"; + add_header 'Cross-Origin-Opener-Policy' 'same-origin' always; + add_header 'Cross-Origin-Embedder-Policy' 'require-corp' always; } # EXAMPLE: Redirect server error pages to the static page /40x.html diff --git a/platform/app/.recipes/OpenResty-Orthanc/docker-compose.yml b/platform/app/.recipes/OpenResty-Orthanc/docker-compose.yml index 824ae5a3e1d..16ec1ada705 100644 --- a/platform/app/.recipes/OpenResty-Orthanc/docker-compose.yml +++ b/platform/app/.recipes/OpenResty-Orthanc/docker-compose.yml @@ -34,7 +34,7 @@ services: # TODO: Update to use Postgres # https://github.com/mrts/docker-postgresql-multiple-databases orthanc: - image: jodogne/orthanc-plugins:1.5.6 + image: jodogne/orthanc-plugins hostname: orthanc container_name: orthanc volumes: diff --git a/platform/app/.recipes/OpenResty-Orthanc/dockerfile b/platform/app/.recipes/OpenResty-Orthanc/dockerfile index 768cbc576e7..8764705dab6 100644 --- a/platform/app/.recipes/OpenResty-Orthanc/dockerfile +++ b/platform/app/.recipes/OpenResty-Orthanc/dockerfile @@ -23,24 +23,19 @@ # Stage 1: Build the application -FROM node:12.22.1-slim as builder +FROM node:16.15.0-slim as builder RUN mkdir /usr/src/app WORKDIR /usr/src/app -# Copy Files -COPY .docker /usr/src/app/.docker -COPY .webpack /usr/src/app/.webpack -COPY extensions /usr/src/app/extensions -COPY modes /usr/src/app/modes -COPY platform /usr/src/app/platform -COPY .browserslistrc /usr/src/app/.browserslistrc -COPY aliases.config.js /usr/src/app/aliases.config.js -COPY babel.config.js /usr/src/app/babel.config.js -COPY lerna.json /usr/src/app/lerna.json -COPY package.json /usr/src/app/package.json -COPY postcss.config.js /usr/src/app/postcss.config.js -COPY yarn.lock /usr/src/app/yarn.lock +# Copy all files from the root of the OHIF source and note +# that the Docker ignore file at the root (i.e. ./dockerignore) will filter +# out files and directories that are not needed. +COPY ./ /usr/src/app/ + +# For arm builds since parcel doesn't have prebuilt binaries for arm yet +RUN apt-get update && apt-get install -y build-essential python3 + # ADD . /usr/src/app/ RUN yarn config set workspaces-experimental true diff --git a/platform/app/public/config/docker_openresty-orthanc-keycloak.js b/platform/app/public/config/docker_openresty-orthanc-keycloak.js index 31786e2626a..5e9f7854f3b 100644 --- a/platform/app/public/config/docker_openresty-orthanc-keycloak.js +++ b/platform/app/public/config/docker_openresty-orthanc-keycloak.js @@ -1,32 +1,39 @@ window.config = { routerBasename: '/', showStudyList: true, + extensions: [], + modes: [], // below flag is for performance reasons, but it might not work for all servers + showWarningMessageForCrossOrigin: true, showCPUFallbackMessage: true, showLoadingIndicator: true, strictZSpacingForVolumeViewport: true, - servers: { - // This is an array, but we'll only use the first entry for now - dicomWeb: [ - { + defaultDataSourceName: 'dicomweb', + dataSources: [ + { + namespace: '@ohif/extension-default.dataSourcesModule.dicomweb', + sourceName: 'dicomweb', + configuration: { + friendlyName: 'Orthanc Server', name: 'Orthanc', - wadoUriRoot: 'http://127.0.0.1/pacs/wado', + wadoUriRoot: 'http://127.0.0.1/pacs/dicom-web', qidoRoot: 'http://127.0.0.1/pacs/dicom-web', wadoRoot: 'http://127.0.0.1/pacs/dicom-web', - qidoSupportsIncludeField: false, + qidoSupportsIncludeField: true, + supportsReject: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - omitQuotationForMultipartRequest: true, - // REQUIRED TAG: - // TODO: Remove tag after https://github.com/OHIF/ohif-core/pull/19 is merged and we bump version - // requestOptions: { - // undefined to use JWT + Bearer auth - // auth: 'orthanc:orthanc', - // }, + enableStudyLazyLoad: true, + supportsFuzzyMatching: true, + supportsWildcard: true, + dicomUploadEnabled: true, + bulkDataURI: { + enabled: true, + }, }, - ], - }, + }, + ], // This is an array, but we'll only use the first entry for now oidc: [ { diff --git a/platform/app/public/config/docker_openresty-orthanc.js b/platform/app/public/config/docker_openresty-orthanc.js index d81e27d206e..2500760bf22 100644 --- a/platform/app/public/config/docker_openresty-orthanc.js +++ b/platform/app/public/config/docker_openresty-orthanc.js @@ -17,13 +17,20 @@ window.config = { configuration: { friendlyName: 'Orthanc Server', name: 'Orthanc', - wadoUriRoot: 'http://127.0.0.1/pacs/wado', + wadoUriRoot: 'http://127.0.0.1/pacs/dicom-web', qidoRoot: 'http://127.0.0.1/pacs/dicom-web', wadoRoot: 'http://127.0.0.1/pacs/dicom-web', - qidoSupportsIncludeField: false, + qidoSupportsIncludeField: true, + supportsReject: true, imageRendering: 'wadors', thumbnailRendering: 'wadors', - omitQuotationForMultipartRequest: true, + enableStudyLazyLoad: true, + supportsFuzzyMatching: true, + supportsWildcard: true, + dicomUploadEnabled: true, + bulkDataURI: { + enabled: true, + }, }, }, { diff --git a/platform/docs/docs/deployment/nginx--image-archive.md b/platform/docs/docs/deployment/nginx--image-archive.md index cbeba05c318..5d96443e58f 100644 --- a/platform/docs/docs/deployment/nginx--image-archive.md +++ b/platform/docs/docs/deployment/nginx--image-archive.md @@ -83,7 +83,7 @@ in command prompt or terminal_ ### Setup -- Navigate to `viewer` folder inside `platform` +- Navigate to `app` folder inside `platform` - then: `cd .recipes/OpenResty-Orthanc` - run: `docker-compose up --build` - Navigate to `127.0.0.1` for the viewer