Builds a production Docker image.
You can pass the following environment variables to control the resulting image name:
Name | Description | Default | Example |
---|---|---|---|
MLRUN_DOCKER_REGISTRY |
sets the Docker registy | (Dockerhub) | quay.io/ |
MLRUN_DOCKER_REPO |
sets the Docker repository | mlrun |
iguazio |
MLRUN_DOCKER_TAG |
sets the Docker image tag | latest |
0.4.9 , unstable |
Note: the trailing forward-slash /
in MLRUN_DOCKER_REGISTRY
's value is significant.
Examples:
Command | Resulting Docker image name |
---|---|
npm run docker |
mlrun/mlrun-ui:latest |
MLRUN_DOCKER_REGISTRY=quay.io/ MLRUN_DOCKER_REPO=iguazio MLRUN_DOCKER_TAG=0.4.9 npm run docker |
quay.io/iguazio/mlrun-ui:0.4.9 |
The Docker container runs an Nginx server, which listens on exposed port number 8090, serves the web-app, and proxies to the backend API.
You can pass the following environment variables to the docker run
command to configure it:
Name | Description |
---|---|
MLRUN_API_PROXY_URL |
Sets the base URL of the backend API Default: http://localhost:8090 Example: http://17.220.101.245:30080 |
MLRUN_NUCLIO_MODE |
Sets the MLRun Nuclio integration mode Default: disabled Example: enabled |
MLRUN_NUCLIO_API_URL |
Sets the base URL of the Nuclio API Default: http://localhost:8070 Example: http://17.220.101.245:30070 |
MLRUN_NUCLIO_UI_URL |
Sets the base URL of the Nuclio UI Default: http://localhost:8070 Example: http://17.220.101.245:30070 |
MLRUN_V3IO_ACCESS_KEY |
Sets the V3IO access key to use for accessing V3IO containers Example: a7097c94-6e8f-436d-9717-a84abe2861d1 |
MLRUN_FUNCTION_CATALOG_URL |
Sets the base URL of the function-template catalog Default: https://raw.githubusercontent.com |
MLRUN_FUNCTION_CATALOG_PATH |
Sets the base URI of the function-template catalog Default: /mlrun/functions/master |
Example:
docker run -it -d -p 8090:8090 --rm --name mlrun-ui -e MLRUN_API_PROXY_URL=http://17.220.101.245:30080 -e MLRUN_NUCLIO_MODE=enabled -e MLRUN_NUCLIO_API_URL=http://17.220.101.245:30070 -e MLRUN_NUCLIO_UI_URL=http://17.220.101.245:30070 -e MLRUN_FUNCTION_CATALOG_URL=https://raw.githubusercontent.com -e MLRUN_FUNCTION_CATALOG_PATH=/mlrun/functions/master -e MLRUN_V3IO_ACCESS_KEY=a7097c94-6e8f-436d-9717-a84abe2861d1 quay.io/mlrun/mlrun-ui:0.4.9
The files served by Nginx server are located at /usr/share/nginx/html
and consist of:
- The production deployment files coming from the
build
folder (created by thenpm run build
command in the Dockerflie). BUILD_DATE
: a file that contains the timestamp of running thenpm run docker
command, for exampleWed Jun 17 15:43:16 UTC 2020
.
In case the Docker container is running and is namedmlrun-ui
, you can use the following command to print the build date:$ docker exec -ti mlrun-ui sh -c "cat /usr/share/nginx/html/BUILD_DATE" Wed Jun 17 15:43:16 UTC 2020
COMMIT_HASH
: a file that contains the short git commit hash (for example:703a554
) of the commit that was at theHEAD
when running thenpm run docker
command.
In case the Docker container is running and is namedmlrun-ui
, you can use the following command to print the short git commit hash:$ docker exec -ti mlrun-ui sh -c "cat /usr/share/nginx/html/COMMIT_HASH" 703a554
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed.
This command is run by the Dockerfile that is used by the command npm run docker
.
Note: npm install
should be run first.
All environemnt variables from production (described here) are expanded to environemt variables that could be used in development, via .env file. In order to override them, add a .env.development.local file next to .env file and override the desired variables. For example:
REACT_APP_MLRUN_API_URL=http://3.129.154.119:30080
REACT_APP_MLRUN_V3IO_ACCESS_KEY=2826d9df-033d-4ac2-b13a-1f8f9d14aaeb
REACT_APP_NUCLIO_API_URL=http://localhost:8070
REACT_APP_NUCLIO_UI_URL=http://localhost:8070
REACT_APP_FUNCTION_CATALOG_URL=https://raw.githubusercontent.com/mlrun/functions/master
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Note: npm install
should be run first.