OHIF custom dev docker

Help for building a Docker dev image

Hi everyone ! I am working on a fork of OHIF. We use it in production with Docker alongside other services such as a datasource. This works very well.

I wanted to create a dev version of the OHIF container, so that I don’t have to rebuild a Docker image each time I modify the code. Thus, I tried using yarn dev instead of yarn build in my dockerfile and exposing the port.

However, this doesn’t seem to work. I mapped the port (3000 → 3000) but I can’t access the application at http://localhost:3000 (I get Cannot GET /. I tried using the --host option as it appears the project is not exposed, but nothing changed. Am I doing something wrong ?

Infos

  • OHIF version : v3.7
  • OS : Fedora 39

Code

docker-compose.yml

ohif-dev:
    build:
      context: .
      dockerfile: ./ohif/dev.dockerfile
      args:
        - OHIF_CONFIG=configs/docker.js
        - OHIF_ROOT_URL=/ohif/
    volumes:
      - ./ohif/viewer/extensions:/usr/src/ohif/extensions
      - ./ohif/viewer/modes:/usr/src/ohif/modes
      - ./ohif/viewer/platform:/usr/src/ohif/platform
    ports:
      - 3000:3000

ohif/dev.dockerfile

FROM node:18-slim as ohif

WORKDIR /usr/src

RUN apt-get update
RUN apt-get -y upgrade

ARG OHIF_CONFIG=default.js
ARG OHIF_ROOT_URL=/

ENV APP_CONFIG=config/${OHIF_CONFIG}
ENV PUBLIC_URL=${OHIF_ROOT_URL}
ENV PATH /usr/src/ohif/node_modules/.bin:$PATH
ENV QUICK_BUILD true

COPY ./ohif/viewer /usr/src/ohif
COPY ./ohif/configs /usr/src/ohif/platform/app/public/config/configs

WORKDIR /usr/src/ohif

RUN yarn config set workspaces-experimental true
RUN yarn install --frozen-lockfile

EXPOSE 3000

CMD [ "yarn", "dev:host" ]

ohif/viewer/package.json

"dev:host": "lerna run dev:host --stream",

ohif/viewer/platform/app/package.json

"dev:host": "cross-env NODE_ENV=development webpack serve --config .webpack/webpack.pwa.js --host 0.0.0.0",