Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Docker build time was very slow on a tiny change #4559

Merged
merged 26 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
de3df7a
fix: Docker build time was very slow on a tiny change
wayfarer3130 Nov 29, 2024
50a6466
fix: Node 20 as the default node version
wayfarer3130 Nov 29, 2024
521ff45
Merge remote-tracking branch 'ohif/master' into fix/docker-build-time
wayfarer3130 Dec 3, 2024
7c5d022
Precompressed NGINX build
wayfarer3130 Dec 8, 2024
335da55
Merge remote-tracking branch 'ohif/master' into fix/docker-build-time
wayfarer3130 Dec 8, 2024
baada86
Change to use bun for install
wayfarer3130 Dec 11, 2024
d6e2cb4
Merge remote-tracking branch 'origin/master' into fix/docker-build-time
wayfarer3130 Dec 11, 2024
6280287
Improve response time
wayfarer3130 Dec 11, 2024
ad1f86c
Fix paths when publicUrl is set
wayfarer3130 Dec 12, 2024
2b626d0
Update docker version
wayfarer3130 Dec 13, 2024
3caf629
publish arm64 docker
sedghi Dec 17, 2024
86829e9
fix: Removed some more build/install files from copy
wayfarer3130 Dec 18, 2024
31917f7
fix datasource path
wayfarer3130 Dec 19, 2024
351ddb5
Add settable PORT
wayfarer3130 Dec 19, 2024
e53be5b
Update the default data source as the other one isn't working
wayfarer3130 Dec 19, 2024
8e6e505
Merge remote-tracking branch 'origin/master' into fix/docker-build-time
wayfarer3130 Dec 19, 2024
f4175ae
Merge branch 'master' into fix/docker-build-time
wayfarer3130 Dec 20, 2024
4ebb977
Add PUBLIC_URL and other build args docs
wayfarer3130 Dec 20, 2024
3e2c0d3
Merge branch 'fix/docker-build-time' of https://github.com/OHIF/Viewe…
wayfarer3130 Dec 20, 2024
50f745e
Added docs on public url
wayfarer3130 Dec 20, 2024
38fb78e
Refactor Docker documentation: consolidate and enhance content on bui…
sedghi Dec 20, 2024
6bda7de
update docs
sedghi Dec 20, 2024
711851d
rename back
sedghi Dec 20, 2024
928d7df
Merge branch 'master' into fix/docker-build-time
wayfarer3130 Jan 2, 2025
0456543
PR comments
wayfarer3130 Jan 2, 2025
7f39f7b
Merge branch 'fix/docker-build-time' of https://github.com/OHIF/Viewe…
wayfarer3130 Jan 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 35 additions & 28 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.7-labs
# This dockerfile is used to publish the `ohif/app` image on dockerhub.
#
# It's a good example of how to build our static application and package it
Expand All @@ -19,45 +20,51 @@
#


# Stage 1: Build the application
# docker build -t ohif/viewer:latest .
FROM node:18.16.1-slim as json-copier

RUN mkdir /usr/src/app
WORKDIR /usr/src/app

COPY ["package.json", "yarn.lock", "preinstall.js", "./"]
COPY extensions /usr/src/app/extensions
COPY modes /usr/src/app/modes
COPY platform /usr/src/app/platform
# syntax=docker/dockerfile:1.7-labs
# This dockerfile is used to publish the `ohif/app` image on dockerhub.
#
# It's a good example of how to build our static application and package it
# with a web server capable of hosting it as static content.
#
# docker build
# --------------
# If you would like to use this dockerfile to build and tag an image, make sure
# you set the context to the project's root directory:
# https://docs.docker.com/engine/reference/commandline/build/
#
#
# SUMMARY
# --------------
# This dockerfile is used as an input for a second stage to make things run faster.
#

# Find and remove non-package.json files
#RUN find extensions \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
#RUN find modes \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf
#RUN find platform \! -name "package.json" -mindepth 2 -maxdepth 2 -print | xargs rm -rf

# Stage 1: Build the application
# docker build -t ohif/viewer:latest .
# Copy Files
FROM node:18.16.1-slim as builder
FROM node:22 as builder
RUN apt-get update && apt-get install -y build-essential python3
RUN mkdir /usr/src/app
WORKDIR /usr/src/app

COPY --from=json-copier /usr/src/app .

# Run the install before copying the rest of the files
RUN yarn config set workspaces-experimental true
RUN yarn install --frozen-lockfile --verbose
# RUN npm install -g [email protected]
ENV PATH=/usr/src/app/node_modules/.bin:$PATH

COPY . .

# To restore workspaces symlinks
RUN yarn install --frozen-lockfile --verbose
# Do an initial install and then a final install
COPY package.json yarn.lock preinstall.js lerna.json ./
COPY --parents ./addOns/package.json ./addOns/*/*/package.json ./extensions/*/package.json ./modes/*/package.json ./platform/*/package.json ./
# Run the install before copying the rest of the files
RUN yarn install
# Copy the local directory
COPY --link --exclude=node_modules --exclude=yarn.lock --exclude=package.json . .
# Do a second install to finalize things after the copy
RUN yarn install

ENV PATH /usr/src/app/node_modules/.bin:$PATH
# Build here
# After install it should hopefully be stable until the local directory changes
ENV QUICK_BUILD true
# ENV GENERATE_SOURCEMAP=false
# ENV REACT_APP_CONFIG=config/default.js

ENV REACT_APP_CONFIG=config/default.js
wayfarer3130 marked this conversation as resolved.
Show resolved Hide resolved
RUN yarn run build

# Stage 3: Bundle the built application into a Docker container
Expand Down
6 changes: 3 additions & 3 deletions platform/app/public/config/kheops.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

window.config = {
routerBasename: '/',
// whiteLabeling: {},
extensions: [],
modes: [],
customizationService: {},
Expand All @@ -24,8 +23,9 @@ window.config = {
prefetch: 25,
},
// filterQueryParam: false,
// Uses the dicomweb proxy as the default URL
defaultDataSourceName: 'dicomwebproxy',
// Uses the ohif datasource as the default - this requires that KHEOPS be
// configured with an OHIF path to .../viewer/dicomwebproxy
defaultDataSourceName: 'ohif2',
/* Dynamic config allows user to pass "configUrl" query string this allows to load config without recompiling application. The regex will ensure valid configuration source */
// dangerouslyUseDynamicConfig: {
// enabled: true,
Expand Down