radames commited on
Commit
c006d0a
1 Parent(s): a176788
Files changed (4) hide show
  1. Dockerfile +56 -0
  2. README.md +5 -0
  3. app-config.js +28 -0
  4. nginx.conf +20 -0
Dockerfile ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM node:16.15.0-slim as json-copier
2
+
3
+ RUN mkdir /usr/src/app
4
+ WORKDIR /usr/src/app
5
+ # Clone the application
6
+ RUN apt-get update && apt-get install -y git
7
+
8
+ RUN git clone --recursive https://github.com/OHIF/Viewers.git .
9
+
10
+ # # COPY ["package.json", "yarn.lock", "preinstall.js", "./"]
11
+ # COPY extensions /usr/src/app/extensions
12
+ # COPY modes /usr/src/app/modes
13
+ # COPY platform /usr/src/app/platform
14
+
15
+ # Find and remove non-package.json files
16
+ #RUN find extensions \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
17
+ #RUN find modes \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
18
+ #RUN find platform \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
19
+
20
+ # Copy Files
21
+ FROM node:16.15.0-slim as builder
22
+ RUN apt-get update && apt-get install -y build-essential python3
23
+ RUN mkdir /usr/src/app
24
+ WORKDIR /usr/src/app
25
+
26
+ COPY --from=json-copier /usr/src/app .
27
+
28
+ # Run the install before copying the rest of the files
29
+ RUN yarn config set workspaces-experimental true
30
+ RUN yarn install --frozen-lockfile --verbose
31
+
32
+ COPY . .
33
+
34
+ # To restore workspaces symlinks
35
+ RUN yarn install --frozen-lockfile --verbose
36
+
37
+ ENV PATH /usr/src/app/node_modules/.bin:$PATH
38
+ ENV QUICK_BUILD true
39
+ # ENV GENERATE_SOURCEMAP=false
40
+ # ENV REACT_APP_CONFIG=config/default.js
41
+
42
+ RUN yarn run build
43
+ # Stage 3: Bundle the built application into a Docker container
44
+ # which runs Nginx using Alpine Linux
45
+ FROM nginxinc/nginx-unprivileged:1.25-alpine as final
46
+ #RUN apk add --no-cache bash
47
+ USER nginx
48
+ COPY --chown=nginx:nginx nginx.conf /etc/nginx/conf.d/default.conf
49
+ COPY --chown=nginx:nginx app.config.js /usr/share/nginx/html/app-config.js
50
+ COPY --from=builder /usr/src/app/platform/app/dist /usr/share/nginx/html
51
+ # In entrypoint.sh, app-config.js might be overwritten, so chmod it to be writeable.
52
+ # The nginx user cannot chmod it, so change to root.
53
+ USER root
54
+ RUN chmod 666 /usr/share/nginx/html/app-config.js
55
+ USER nginx
56
+ CMD ["nginx", "-g", "daemon off;"]
README.md CHANGED
@@ -5,6 +5,11 @@ colorFrom: purple
5
  colorTo: yellow
6
  sdk: docker
7
  pinned: false
 
 
 
 
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
5
  colorTo: yellow
6
  sdk: docker
7
  pinned: false
8
+ custom_headers:
9
+ cross-origin-embedder-policy: require-corp
10
+ cross-origin-opener-policy: same-origin
11
+ cross-origin-resource-policy: cross-origin
12
+
13
  ---
14
 
15
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app-config.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ window.config = {
2
+ routerBasename: "/",
3
+ extensions: [],
4
+ modes: [],
5
+ showStudyList: true,
6
+ dataSources: [
7
+ {
8
+ namespace: "@ohif/extension-default.dataSourcesModule.dicomweb",
9
+ sourceName: "dicomweb",
10
+ configuration: {
11
+ friendlyName: "dcmjs DICOMWeb Server",
12
+ name: "DCM4CHEE",
13
+ wadoUriRoot: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/wado",
14
+ qidoRoot: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs",
15
+ wadoRoot: "https://server.dcmjs.org/dcm4chee-arc/aets/DCM4CHEE/rs",
16
+ qidoSupportsIncludeField: true,
17
+ supportsReject: true,
18
+ imageRendering: "wadors",
19
+ thumbnailRendering: "wadors",
20
+ enableStudyLazyLoad: true,
21
+ supportsFuzzyMatching: true,
22
+ supportsWildcard: true,
23
+ omitQuotationForMultipartRequest: true,
24
+ },
25
+ },
26
+ ],
27
+ defaultDataSourceName: "dicomweb",
28
+ };
nginx.conf ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ server {
2
+ listen 7860 default_server;
3
+ listen [::]:7860 default_server;
4
+ location / {
5
+ root /usr/share/nginx/html;
6
+ index index.html index.htm;
7
+ try_files $uri $uri/ /index.html;
8
+ add_header Cross-Origin-Opener-Policy same-origin;
9
+ # add_header Cross-Origin-Embedder-Policy require-corp;
10
+ add_header Cross-Origin-Resource-Policy same-origin;
11
+ proxy_set_header Host $host;
12
+ proxy_set_header X-Real-IP $remote_addr;
13
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
14
+ proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
15
+ }
16
+ error_page 500 502 503 504 /50x.html;
17
+ location = /50x.html {
18
+ root /usr/share/nginx/html;
19
+ }
20
+ }