PUBLIC_URL env variable does not seem to work using the published docker
Hi all
We are attempting to use the published OHIF docker image in a system that requires the URL to be set at run time. We looked through the documents and found the PUBLIC_URL environment variable but it doesn't seem to be working as expected. For example we thought we could add something like
- PUBLIC_URL=/private/some-user-name/some-app-name/some-random-unique-id/
to our docker compose file and find the app at the URL but it doesn't seem to be working. Any advice or ideas would be most appreciated.
Thanks Howard Lander
I think that it's the same problem I am facing. Here is the relevant Compose section:
ohif:
image: ohif/viewer
environment:
- PUBLIC_URL=/ohif/
ports:
- 19861:80
volumes:
- ./ohif/app-config.js:/usr/share/nginx/html/app-config.js
# - ./ohif/nginx.conf:/etc/nginx/nginx.conf:ro
But OHIF doesn't look for assets and scripts starting from /ohif/. However, routerBasename works as expected and i can serve the application at localhost:19861/ohif/
Hi @HowardLander and @Diegovictorbr Perhaps you can use Docker variables to specify URL at run time. Below are excerpts from working docker-compose.yml:
viewer: image: ohif/viewer:v1.x container_name: viewer depends_on: - mongo - orthanc restart: always networks: - frontend - backend volumes: # OHIF Viewer configuration to reach Orthanc DICOMWeb - ${VIEWER_CONFIG:-./config/viewer.js}:/app/app.json:ro environment: - MONGO_URL=${MONGO_URL:-mongodb://mongo:27017/ohif}
nginx: image: nginx container_name: nginx restart: always networks: - frontend ports: - 80:80 - 443:443 volumes: # Nginx as reverse proxy for orthanc and viewer - ${NGINX_DEFAULT_CONF:-./nginx/default.conf}:/etc/nginx/conf.d/default.conf - certbot-etc:/etc/letsencrypt - certbot-var:/var/lib/letsencrypt - web-root:/var/www/html - dhparam:/etc/ssl/certs
certbot: image: certbot/certbot container_name: certbot volumes: - certbot-etc:/etc/letsencrypt - certbot-var:/var/lib/letsencrypt - web-root:/var/www/html depends_on: - viewer command: certonly --webroot --webroot-path=/var/www/html --email [emailaddress] --text --agree-tos --no-eff-email --force-renewal -d [URL]
networks: frontend: backend:
volumes: certbot-etc: certbot-var: web-root: driver: local driver_opts: type: none device: [host filesystem location] o: bind dhparam: driver: local driver_opts: type: none device: [host filesystem location] o: bind
Hey! Take a look at my solution here
has anyone found a way to do this without needing to build the docker? to update this value in an existing image?
Pretty sure we fixed it recently
https://docs.ohif.org/deployment/docker
Hi @sedghi - are PUBLIC_URL and routerBasename for non-root path still needed when OHIF is a docker container behind a reverse proxy?