Add dockerfile for ohif-viewer package

This commit is contained in:
Erik Ziegler 2019-01-30 18:36:25 +00:00
parent 0804bc1177
commit fbcc4fcf40
2 changed files with 65 additions and 38 deletions

View File

@ -0,0 +1,29 @@
# Stage 1: Build the application
# docker build -t ohif/viewer:latest .
FROM node:11.2.0-slim as builder
RUN apt-get update && apt-get install -y git yarn
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
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
ADD . /usr/src/app/
RUN yarn install
RUN yarn run build
WORKDIR example
RUN yarn install
RUN yarn run prepare
ADD example /usr/src/app/build
# Stage 2: Bundle the built application into a Docker container
# which runs Nginx using Alpine Linux
FROM nginx:1.15.5-alpine
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx
COPY --from=builder /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -36,7 +36,7 @@
<!-- Load React. --> <!-- Load React. -->
<!-- Note: when deploying, replace "development.js" with "production.min.js". --> <!-- Note: when deploying, replace "development.js" with "production.min.js". -->
<script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script> <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script> <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<!--<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script> <!--<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>!--> <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>!-->
@ -57,22 +57,9 @@
<!-- Load our React component. --> <!-- Load our React component. -->
<script> <script>
'use strict';
var routerBasename = 'http://localhost:5000';
var props = { var props = {
routerBasename: routerBasename "routerBasename": "http://localhost:5000",
}; "servers": {
/*
Example config with OIDC
*/
// Uncomment the next two blocks, comment out the config without OIDC
// Try going to:
// http://localhost:5000/viewer/1.3.6.1.4.1.25403.345050719074.3824.20170126082328.1
// http://ohif-viewer-react.s3-website-us-east-1.amazonaws.com/viewer/1.3.6.1.4.1.25403.345050719074.3824.20170126082328.1
props.servers = {
"dicomWeb": [{ "dicomWeb": [{
"name": "DCM4CHEE", "name": "DCM4CHEE",
"wadoUriRoot": "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/wado", "wadoUriRoot": "https://cancer.crowds-cure.org/dcm4chee-arc/aets/DCM4CHEE/wado",
@ -86,12 +73,11 @@
} }
} }
] ]
}; },
"oidc": [{
props.oidc = [{
"authServerUrl": "https://cancer.crowds-cure.org/auth/realms/dcm4che", "authServerUrl": "https://cancer.crowds-cure.org/auth/realms/dcm4che",
"authRedirectUri": routerBasename + '/callback', "authRedirectUri": "http://localhost:5000/callback",
"postLogoutRedirectUri": routerBasename + '/logout-redirect.html', "postLogoutRedirectUri": "http://localhost:5000/logout-redirect.html",
"clientId": "crowds-cure-cancer", "clientId": "crowds-cure-cancer",
"responseType": "id_token token", "responseType": "id_token token",
"scope": "email profile openid", "scope": "email profile openid",
@ -100,7 +86,19 @@
"kc_idp_hint": "crowds-cure-cancer-auth0-oidc", "kc_idp_hint": "crowds-cure-cancer-auth0-oidc",
"client_id": "crowds-cure-cancer" "client_id": "crowds-cure-cancer"
} }
}]; }]
};
</script>
<script>
'use strict';
/*
Example config with OIDC
*/
// Uncomment the next two blocks, comment out the config without OIDC
// Try going to:
// http://localhost:5000/viewer/1.3.6.1.4.1.25403.345050719074.3824.20170126082328.1
// http://ohif-viewer-react.s3-website-us-east-1.amazonaws.com/viewer/1.3.6.1.4.1.25403.345050719074.3824.20170126082328.1
/* Example config without OIDC */ /* Example config without OIDC */
// Try going to: // Try going to:
@ -162,9 +160,9 @@
); );
} }
props.whiteLabelling = { /*props.whiteLabelling = {
logoComponent: RadicalImagingLogo() logoComponent: RadicalImagingLogo()
} }*/
// TODO: Why do we need to do this? Something is wrong with our rollup settings // TODO: Why do we need to do this? Something is wrong with our rollup settings
var Viewer = window.OHIFStandaloneViewer.App; var Viewer = window.OHIFStandaloneViewer.App;