Skip to content

Commit 6ee13b7

Browse files
update README
1 parent d984f69 commit 6ee13b7

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

docker/README.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@
22

33
To build the image you can execute `./build.sh`, or:
44

5+
```bash
6+
docker build -t autosubmit-gui
7+
```
8+
9+
> **NOTE**: The default image builds a GUI which `AUTOSUBMIT_API_SOURCE` is the relative path `/api`. This is needed if you want to change it using environment variables when starting the container.
10+
11+
On the build, you can fix a API URL by doing:
12+
513
```bash
614
docker build \
7-
--build-arg "AUTOSUBMIT_API_SOURCE=http://127.0.0.1:8000" \ # Required argument
15+
--build-arg "AUTOSUBMIT_API_SOURCE=http://127.0.0.1:8000" \
816
-t autosubmit-gui
917
```
1018

11-
On the build, you can select a different tag/branch/commit by running:
19+
Also, you can select a different tag/branch/commit by running:
1220

1321
```bash
1422
docker build \
@@ -17,7 +25,9 @@ docker build \
1725
-t autosubmit-gui
1826
```
1927

20-
Other `--build-arg` are available that are related to the build environment variables with prefix `REACT_APP_`. See the `Dockerfile` to know more about it. **Note: This environment variables are only used while building, modifying them on runtime will not make any change.**
28+
Other `--build-arg` are available that are related to the build environment variables with prefix `REACT_APP_`. See the `Dockerfile` to know more about it.
29+
30+
> **IMPORTANT: This environment variables that are set using the build arguments are only used while building, modifying them on runtime will not make any change.**
2131
2232
## Run
2333

@@ -29,4 +39,19 @@ docker run --name autosubmit-gui-container \
2939
autosubmit-gui
3040
```
3141

32-
**Remember to map the port `8080` to the one you desire. In the example above, it is mapped to port `8089`.**
42+
**Remember to map the port `8080` to the one you desire. In the example above, it is mapped to port `8089`.**
43+
44+
If the `AUTOSUBMIT_API_SOURCE` was not set during the build, the GUI will use the relative path `/api`. This means, if the GUI is served in `localhost:8080`, it will send the API requests to `localhost:8080/api`.
45+
46+
This mechanism works because the container can proxy the requests sent to `localhost:8080/api` to another URL using Nginx. And this can be set doing:
47+
48+
```bash
49+
docker run --name autosubmit-gui-container \
50+
--rm -d -p 8080:8080 \
51+
-e "API_URL_PROXY=https://hostname/external-as-api/" \
52+
autosubmit-gui
53+
```
54+
55+
This will forward the requests send to `localhost:8080/api` to `https://hostname/external-as-api/`. For example, `GET localhost:8080/api/v4/experiments` will go to `GET https://hostname/external-as-api/v4/experiments`.
56+
57+
With this option there is no need to build the image again.

docker/build.sh

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
#!/bin/bash
22

3-
docker build \
4-
--build-arg "AUTOSUBMIT_API_SOURCE=http://127.0.0.1:8000" \
5-
-t autosubmit-gui --progress=plain . &> build.log
3+
docker build -t autosubmit-gui --progress=plain . &> build.log

0 commit comments

Comments
 (0)