2021-06-16 05:32:37 +02:00
|
|
|
---
|
|
|
|
|
sidebar_position: 2
|
|
|
|
|
---
|
2021-03-01 16:52:54 +01:00
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
# Build for Production
|
2021-03-01 16:52:54 +01:00
|
|
|
|
|
|
|
|
### Build Machine Requirements
|
|
|
|
|
|
|
|
|
|
- [Node.js & NPM](https://nodejs.org/en/download/)
|
|
|
|
|
- [Yarn](https://yarnpkg.com/lang/en/docs/install/)
|
|
|
|
|
- [Git](https://www.atlassian.com/git/tutorials/install-git)
|
|
|
|
|
|
|
|
|
|
### Getting the Code
|
|
|
|
|
|
|
|
|
|
_With Git:_
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
# Clone the remote repository to your local machine
|
|
|
|
|
git clone https://github.com/OHIF/Viewers.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
More on: _[`git clone`](https://git-scm.com/docs/git-clone),
|
|
|
|
|
[`git checkout`](https://git-scm.com/docs/git-checkout)_
|
|
|
|
|
|
|
|
|
|
_From .zip:_
|
|
|
|
|
|
2021-07-15 09:54:01 +02:00
|
|
|
[OHIF/Viewers: master.zip](https://github.com/OHIF/Viewers/archive/master.zip)
|
2021-03-01 16:52:54 +01:00
|
|
|
|
|
|
|
|
### Restore Dependencies & Build
|
|
|
|
|
|
|
|
|
|
Open your terminal, and navigate to the directory containing the source files.
|
|
|
|
|
Next run these commands:
|
|
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
```bash
|
2021-07-15 09:54:01 +02:00
|
|
|
# If you haven't already, enable yarn workspaces
|
2021-03-01 16:52:54 +01:00
|
|
|
yarn config set workspaces-experimental true
|
|
|
|
|
|
2021-07-15 09:54:01 +02:00
|
|
|
# Restore dependencies
|
2021-03-01 16:52:54 +01:00
|
|
|
yarn install
|
|
|
|
|
|
2021-07-15 09:54:01 +02:00
|
|
|
# Build source code for production
|
2021-03-01 16:52:54 +01:00
|
|
|
yarn run build
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If everything worked as expected, you should have a new `dist/` directory in the
|
2023-06-06 19:34:26 +02:00
|
|
|
`platform/app/dist` folder. It should roughly resemble the following:
|
2021-03-01 16:52:54 +01:00
|
|
|
|
2023-06-06 19:34:26 +02:00
|
|
|
```bash title="<root>platform/app/dist/"
|
2021-03-01 16:52:54 +01:00
|
|
|
├── app-config.js
|
|
|
|
|
├── app.bundle.js
|
|
|
|
|
├── app.css
|
|
|
|
|
├── index.html
|
|
|
|
|
├── manifest.json
|
|
|
|
|
├── service-worker.js
|
|
|
|
|
└── ...
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
By default, the build output will connect to OHIF's publicly accessible PACS. If
|
|
|
|
|
this is your first time setting up the OHIF Viewer, it is recommended that you
|
|
|
|
|
test with these default settings. After testing, you can find instructions on
|
|
|
|
|
how to configure the project for your own imaging archive below.
|
|
|
|
|
|
|
|
|
|
### Configuration
|
|
|
|
|
|
2023-06-06 19:34:26 +02:00
|
|
|
The configuration for our viewer is in the `<root>platform/app/public/config`
|
2021-03-01 16:52:54 +01:00
|
|
|
directory. Our build process knows which configuration file to use based on the
|
|
|
|
|
`APP_CONFIG` environment variable. By default, its value is
|
|
|
|
|
[`config/default.js`][default-config]. The majority of the viewer's features,
|
|
|
|
|
and registered extension's features, are configured using this file.
|
|
|
|
|
|
|
|
|
|
The easiest way to apply your own configuration is to modify the `default.js`
|
2022-03-03 17:28:07 +01:00
|
|
|
file. For more advanced configuration options, check out our
|
2023-06-20 16:26:05 +02:00
|
|
|
[configuration essentials guide](../configuration/configurationFiles.md).
|
2021-03-01 16:52:54 +01:00
|
|
|
|
|
|
|
|
## Next Steps
|
|
|
|
|
|
|
|
|
|
### Deploying Build Output
|
|
|
|
|
|
|
|
|
|
_Drag-n-drop_
|
|
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
- [Netlify: Drop](./static-assets#netlify-drop)
|
2021-03-01 16:52:54 +01:00
|
|
|
|
|
|
|
|
_Easy_
|
|
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
- [Surge.sh](./static-assets#surgesh)
|
|
|
|
|
- [GitHub Pages](./static-assets#github-pages)
|
2021-03-01 16:52:54 +01:00
|
|
|
|
|
|
|
|
_Advanced_
|
|
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
- [AWS S3 + Cloudfront](./static-assets#aws-s3--cloudfront)
|
|
|
|
|
- [GCP + Cloudflare](./static-assets#gcp--cloudflare)
|
|
|
|
|
- [Azure](./static-assets#azure)
|
2021-03-01 16:52:54 +01:00
|
|
|
|
|
|
|
|
### Testing Build Output Locally
|
|
|
|
|
|
|
|
|
|
A quick way to test your build output locally is to spin up a small webserver.
|
|
|
|
|
You can do this by running the following commands in the `dist/` output
|
|
|
|
|
directory:
|
|
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
```bash
|
2021-07-15 09:54:01 +02:00
|
|
|
# Install http-server as a globally available package
|
2021-03-01 16:52:54 +01:00
|
|
|
yarn global add http-server
|
|
|
|
|
|
2023-06-06 19:34:26 +02:00
|
|
|
# Change the directory to the platform/app
|
2021-06-16 01:14:37 +02:00
|
|
|
|
2021-07-15 09:54:01 +02:00
|
|
|
# Serve the files in our current directory
|
|
|
|
|
# Accessible at: `http://localhost:8080`
|
2021-06-16 01:14:37 +02:00
|
|
|
npx http-server ./dist
|
2021-03-01 16:52:54 +01:00
|
|
|
```
|
|
|
|
|
|
2023-06-20 16:26:05 +02:00
|
|
|
:::caution
|
|
|
|
|
In the video below notice that there is `platform/viewer` which has been renamed to `platform/app` in the latest version
|
|
|
|
|
:::
|
|
|
|
|
|
2021-06-16 05:32:37 +02:00
|
|
|
<div style={{padding:"56.25% 0 0 0", position:"relative"}}>
|
|
|
|
|
<iframe src="https://player.vimeo.com/video/551957266?badge=0&autopause=0&player_id=0&app_id=58479" frameBorder="0" allow="autoplay; fullscreen; picture-in-picture" allowFullScreen style= {{ position:"absolute",top:0,left:0,width:"100%",height:"100%"}} title="measurement-report"></iframe>
|
|
|
|
|
</div>
|
2021-06-16 01:14:37 +02:00
|
|
|
|
2021-03-01 16:52:54 +01:00
|
|
|
### Automating Builds and Deployments
|
|
|
|
|
|
2021-06-16 01:14:37 +02:00
|
|
|
If you found setting up your environment and running all of these steps to be a
|
2021-03-01 16:52:54 +01:00
|
|
|
bit tedious, then you are in good company. Thankfully, there are a large number
|
|
|
|
|
of tools available to assist with automating tasks like building and deploying
|
|
|
|
|
web application. For a starting point, check out this repository's own use of:
|
|
|
|
|
|
|
|
|
|
- [CircleCI][circleci]: [config.yaml][circleci-config]
|
|
|
|
|
- [Netlify][netlify]: [netlify.toml][netlify.toml] |
|
|
|
|
|
[build-deploy-preview.sh][build-deploy-preview.sh]
|
|
|
|
|
|
|
|
|
|
<!-- prettier-ignore-start -->
|
|
|
|
|
[circleci]: https://circleci.com/gh/OHIF/Viewers
|
|
|
|
|
[circleci-config]: https://github.com/OHIF/Viewers/blob/master/.circleci/config.yml
|
|
|
|
|
[netlify]: https://app.netlify.com/sites/ohif/deploys
|
2023-06-20 16:26:05 +02:00
|
|
|
[netlify.toml]: https://github.com/OHIF/Viewers/blob/master/platform/app/netlify.toml
|
2021-03-01 16:52:54 +01:00
|
|
|
[build-deploy-preview.sh]: https://github.com/OHIF/Viewers/blob/master/.netlify/build-deploy-preview.sh
|
|
|
|
|
<!-- prettier-ignore-end -->
|