[#879] Clarify the use of the production build script, and when configuration is processed.

This commit is contained in:
Mark H. Wood
2020-09-30 17:04:45 -04:00
parent c67d2e6718
commit 17caa779c1
2 changed files with 4 additions and 2 deletions

1
.gitignore vendored
View File

@@ -39,3 +39,4 @@ package-lock.json
.java-version .java-version
.env .env
/nbproject/

View File

@@ -109,6 +109,7 @@ export DSPACE_HOST=dspace7.4science.cloud
The priority works as follows: **environment variable** overrides **variable in `.env` file** overrides **`environment.(prod, dev or test).ts`** overrides **`environment.common.ts`** The priority works as follows: **environment variable** overrides **variable in `.env` file** overrides **`environment.(prod, dev or test).ts`** overrides **`environment.common.ts`**
These configuration sources are collected **at build time**, and written to `src/environments/environment.ts`. At runtime the configuration is fixed, and neither `.env` nor the process' environment will be consulted.
#### Using environment variables in code #### Using environment variables in code
To use environment variables in a UI component, use: To use environment variables in a UI component, use:
@@ -134,14 +135,14 @@ To build the app for production and start the server run:
```bash ```bash
yarn start yarn start
``` ```
This will run the application in an instance of the Express server, which is included.
If you only want to build for production, without starting, run: If you only want to build for production, without starting, run:
```bash ```bash
yarn run build:prod yarn run build:prod
``` ```
This will build the application and put the result in the `dist` folder. You can copy this folder to wherever you need it for your application server. If you will be using the built-in Express server, you'll also need a copy of the `node_modules` folder tucked inside your copy of `dist`.
This will build the application and put the result in the `dist` folder
### Running the application with Docker ### Running the application with Docker