OHIF / Viewers

OHIF zero-footprint DICOM viewer and oncology specific Lesion Tracker, plus shared extension packages
https://docs.ohif.org/
MIT License
3.12k stars 3.29k forks source link

[Bug] Docker Build failing at yarn run build #4172

Open highoncarbs opened 4 months ago

highoncarbs commented 4 months ago

Describe the Bug

I am building the docker image as described in the documentation. I did a fresh git clone and ran docker build. It fails to build the image, but a regular yarn run build is building the Viewer

Here's the error

44.68 @ohif/app: Circular dependency between chunks with runtime (app, polySeg, suv-peak-worker)
44.68 @ohif/app: This prevents using hashes of each other and should be avoided.
44.68 @ohif/app: ERROR in ../../../extensions/default/src/getCustomizationModule.tsx 3:0-83
44.68 @ohif/app: Module not found: Error: Can't resolve './components/ProgressDropdownWithService' in '/usr/src/app/extensions/default/src'
44.68 @ohif/app: Did you miss the leading dot in 'resolve.extensions'? Did you mean '[".js",".jsx",".json",".ts",".tsx",".*"]' instead of '[".js",".jsx",".json",".ts",".tsx","*"]'?
44.68 @ohif/app: resolve './components/ProgressDropdownWithService' in '/usr/src/app/extensions/default/src'
44.68 @ohif/app:   using description file: /usr/src/app/extensions/default/package.json (relative path: ./src)
44.68 @ohif/app:     Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:     using description file: /usr/src/app/extensions/default/package.json (relative path: ./src/components/ProgressDropdownWithService)
44.68 @ohif/app:       no extension
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService doesn't exist
44.68 @ohif/app:       .js
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.js doesn't exist
44.68 @ohif/app:       .jsx
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.jsx doesn't exist
44.68 @ohif/app:       .json
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.json doesn't exist
44.68 @ohif/app:       .ts
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.ts doesn't exist
44.68 @ohif/app:       .tsx
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.tsx doesn't exist
44.68 @ohif/app:       *
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService* doesn't exist
44.68 @ohif/app:       as directory
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService doesn't exist
44.68 @ohif/app:  @ ../../../extensions/default/src/index.ts 9:0-62 42:2-24
44.68 @ohif/app:  @ ./pluginImports.js
44.68 @ohif/app:  @ ./index.js 19:0-89 33:4-21 34:4-16
44.68 @ohif/app: ERROR in ../../../extensions/default/src/getToolbarModule.tsx 6:0-83
44.68 @ohif/app: Module not found: Error: Can't resolve './components/ProgressDropdownWithService' in '/usr/src/app/extensions/default/src'
44.68 @ohif/app: Did you miss the leading dot in 'resolve.extensions'? Did you mean '[".js",".jsx",".json",".ts",".tsx",".*"]' instead of '[".js",".jsx",".json",".ts",".tsx","*"]'?
44.68 @ohif/app: resolve './components/ProgressDropdownWithService' in '/usr/src/app/extensions/default/src'
44.68 @ohif/app:   using description file: /usr/src/app/extensions/default/package.json (relative path: ./src)
44.68 @ohif/app:     Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:     using description file: /usr/src/app/extensions/default/package.json (relative path: ./src/components/ProgressDropdownWithService)
44.68 @ohif/app:       no extension
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService doesn't exist
44.68 @ohif/app:       .js
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.js doesn't exist
44.68 @ohif/app:       .jsx
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.jsx doesn't exist
44.68 @ohif/app:       .json
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.json doesn't exist
44.68 @ohif/app:       .ts
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.ts doesn't exist
44.68 @ohif/app:       .tsx
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.tsx doesn't exist
44.68 @ohif/app:       *
44.68 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService* doesn't exist
44.68 @ohif/app:       as directory
44.68 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService doesn't exist
44.68 @ohif/app:  @ ../../../extensions/default/src/index.ts 5:0-50 30:2-18
44.68 @ohif/app:  @ ./pluginImports.js
44.68 @ohif/app:  @ ./index.js 19:0-89 33:4-21 34:4-16
44.68 @ohif/app: webpack 5.91.0 compiled with 2 errors and 1 warning in 34380 ms (cedfee9b9afaf58c5a09)
@ohif/app: error Command failed with exit code 1.
@ohif/app: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@ohif/app: error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
44.93
44.93
44.93
44.93  >  Lerna (powered by Nx)   Running target build:viewer for project @ohif/app failed
44.93
44.93    Failed tasks:
44.93
44.93    - @ohif/app:build:viewer
44.93
44.93    Hint: run the command with --verbose for more details.
44.93
44.96 error Command failed with exit code 1.
44.96 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
Dockerfile:61
--------------------
  59 |     # ENV REACT_APP_CONFIG=config/default.js
  60 |
  61 | >>> RUN yarn run build
  62 |
  63 |     # Stage 3: Bundle the built application into a Docker container
--------------------
ERROR: failed to solve: process "/bin/sh -c yarn run build" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/default/default/g3vbyke2uro0kp7v0hbs3gvrl

Steps to Reproduce

docker build . -t ohif

The current behavior

Failing at yarn run build

The expected behavior

Should build an image

OS

Windows 11

Node version

20

Browser

Latest Chrome and edge

sedghi commented 4 months ago

I'm really surprised, since we build each beta release and push it to dockerhub

highoncarbs commented 4 months ago

@sedghi I know, this is super weird, even tried cloning multiple times and checking. The local builds just fine. Any idea ? Also it would be helpful if you could help in my other issue as well.

highoncarbs commented 4 months ago

@sedghi this is happening with the master branch, and 3.9 I guess where these two files were committed. on 3.5 it works fine

eriklofblad commented 4 months ago

I had the same issue when trying to build it with Docker on a Windows 11 machine but it works just fine when building with docker in linux. I solved it by changing the import statement for ProgressDropdownWithService from this: import ProgressDropdownWithService from './components/ProgressDropdownWithService'; to this: import ProgressDropdownWithService from './Components/ProgressDropdownWithService'; in the files /extensions/default/src/getToolbarModule.tsx and /extensions/default/src/getCustomizationModule.tsx

Is it perhaps case sensitive when running in Windows?

highoncarbs commented 4 months ago

I figured these must have been due to windows @eriklofblad thanks! Also do you happen to share some insights on this as well Issue 4161 , would appreciate it.

sedghi commented 4 months ago

I'm revisiting Docker builds, Nginx, and Keycloak stuff this week.

ctpaep commented 4 months ago

@sedghi Hi could this be due to the fact that there are two folders in the /src directory: Components and components? I took a screenshot of your repository for clarity. баг

sedghi commented 4 months ago

@ctpaep Good catch, i'm fixing it in a minute

sedghi commented 4 months ago

This will fix it , sorry https://github.com/OHIF/Viewers/pull/4192

yairroze commented 4 months ago

I had the same issue when trying to build it with Docker on a Windows 11 machine but it works just fine when building with docker in linux. I solved it by changing the import statement for ProgressDropdownWithService from this: import ProgressDropdownWithService from './components/ProgressDropdownWithService'; to this: import ProgressDropdownWithService from './Components/ProgressDropdownWithService'; in the files /extensions/default/src/getToolbarModule.tsx and /extensions/default/src/getCustomizationModule.tsx

Is it perhaps case sensitive when running in Windows?

I see the same issue with tag v3.8.0 and Mac. I also had to update this file Viewers/extensions/default/src/getCustomizationModule.tsx to fix the docker build issue.

95.72 @ohif/app: ERROR in ../../../extensions/default/src/getCustomizationModule.tsx 3:0-83
95.72 @ohif/app: Module not found: Error: Can't resolve './components/ProgressDropdownWithService' in '/usr/src/app/extensions/default/src'
95.72 @ohif/app: Did you miss the leading dot in 'resolve.extensions'? Did you mean '[".js",".jsx",".json",".ts",".tsx",".*"]' instead of '[".js",".jsx",".json",".ts",".tsx","*"]'?
95.72 @ohif/app: resolve './components/ProgressDropdownWithService' in '/usr/src/app/extensions/default/src'
95.72 @ohif/app:   using description file: /usr/src/app/extensions/default/package.json (relative path: ./src)
95.72 @ohif/app:     Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:     using description file: /usr/src/app/extensions/default/package.json (relative path: ./src/components/ProgressDropdownWithService)
95.72 @ohif/app:       no extension
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService doesn't exist
95.72 @ohif/app:       .js
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.js doesn't exist
95.72 @ohif/app:       .jsx
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.jsx doesn't exist
95.72 @ohif/app:       .json
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.json doesn't exist
95.72 @ohif/app:       .ts
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.ts doesn't exist
95.72 @ohif/app:       .tsx
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService.tsx doesn't exist
95.72 @ohif/app:       *
95.72 @ohif/app:         Field 'browser' doesn't contain a valid alias configuration
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService* doesn't exist
95.72 @ohif/app:       as directory
95.72 @ohif/app:         /usr/src/app/extensions/default/src/components/ProgressDropdownWithService doesn't exist
95.72 @ohif/app:  @ ../../../extensions/default/src/index.ts 9:0-62 42:2-24
95.72 @ohif/app:  @ ./pluginImports.js
95.72 @ohif/app:  @ ./index.js 19:0-89 33:4-21 34:4-16
95.72 @ohif/app: webpack 5.91.0 compiled with 1 error and 1 warning in 84682 ms (a7049b4172118429b0e6)
sedghi commented 4 months ago

@yairroze check master it is fiex now