Trying to setup local CORS; better docker dir naming

This commit is contained in:
dannyrb 2019-05-10 00:09:04 -04:00
parent 450385391e
commit f42459eb9e
8 changed files with 76 additions and 58 deletions

View File

@ -0,0 +1,48 @@
worker_processes 1;
events { worker_connections 1024; }
http {
upstream orthanc-server {
server orthanc:8042;
}
server {
listen [::]:80 default_server;
listen 80;
# CORS Magic
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow_Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow_Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
proxy_pass http://orthanc:8042;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
# CORS Magic
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow_Credentials' 'true';
add_header 'Access-Control-Allow-Headers' 'Authorization,Accept,Origin,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range';
add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS,PUT,DELETE,PATCH';
}
}
}

View File

@ -1,39 +0,0 @@
# docker-compose:
# https://docs.docker.com/compose/overview/
version: '3.5'
services:
orthanc:
container_name: orthanc
image: jodogne/orthanc-plugins
volumes:
- ../sampledata:/sampledata
ports:
- '4242:4242'
- '8042:8042'
restart: always
viewer:
container_name: ohif-viewer
build:
# Up to the root directory
context: ../
# Use our dockerfile to build the viewer
dockerfile: dockerfile
ports:
- '80:80'
depends_on:
- orthanc
environment:
- NODE_ENV=production
- REACT_APP_CONFIG=config/local_orthanc.js
restart: always
volumes:
- ../config/local_orthanc.js:/usr/share/nginx/html/servers.js
proxy:
image: nginx
restart: always
ports:
- 8899:80
volumes:
- ./nginx-proxy/conf/nginx.conf:/etc/nginx/nginx.conf:ro

View File

@ -0,0 +1,26 @@
version: '3.5'
services:
proxy:
image: nginx:1.15-alpine
ports:
- 8899:80
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
restart: unless-stopped
# LINK: https://hub.docker.com/r/jodogne/orthanc-plugins/
# TODO: Update to use Postgres
# https://github.com/mrts/docker-postgresql-multiple-databases
orthanc:
image: jodogne/orthanc-plugins:1.5.6
hostname: orthanc
volumes:
# Config
- ./config/orthanc.json:/etc/orthanc/orthanc.json:ro
# Persist data
- ./volumes/orthanc-db/:/var/lib/orthanc/db/
# ports:
# - '4242:4242' # DICOM
# - '8042:8042' # Web
restart: unless-stopped

View File

@ -1,15 +0,0 @@
# LINK: https://hub.docker.com/r/jodogne/orthanc-plugins/
# TODO: Update to use Postgres
# https://github.com/mrts/docker-postgresql-multiple-databases
orthanc:
image: jodogne/orthanc-plugins:1.5.6
hostname: orthanc
volumes:
# Config
- ./config/orthanc.json:/etc/orthanc/orthanc.json:ro
# Persist data
- ./volumes/orthanc-db/:/var/lib/orthanc/db/
ports:
- '4242:4242'
- '8042:8042'
restart: unless-stopped

View File

@ -28,8 +28,8 @@
"start": "yarn run dev",
"predeploy": "cd example && npm install && yarn run build:package",
"preBuild": "yarn run version && yarn run copy:webworkers",
"orthanc:up": "docker-compose -f docker/Orthanc/docker-compose.yml up",
"orthanc:down": "docker-compose -f docker/Orthanc/docker-compose.yml down",
"orthanc:up": "docker-compose -f docker/Nginx-Orthanc/docker-compose.yml up",
"dev:orthanc": "yarn run preBuild && cross-env PORT=5000 REACT_APP_CONFIG=config/docker_nginx-orthanc.js react-scripts start",
"version": "node -p -e \"'export default \\'' + require('./package.json').version + '\\';'\" > src/version.js",
"copy:webworkers": "cpx 'node_modules/cornerstone-wado-image-loader/dist/*.min.js*' public"
},

View File

@ -1,7 +1,5 @@
window.config = {
// default: '/'
routerBasename: '/',
// default: ''
relativeWebWorkerScriptsPath: '',
servers: {
dicomWeb: [