refactor(docker): use templating to handle env variables (#8878)
Refs #8877
This commit is contained in:
@@ -64,7 +64,7 @@ const ui = SwaggerUIBundle({
|
||||
|
||||
You can pull a pre-built docker image of the swagger-ui directly from Docker Hub:
|
||||
|
||||
```
|
||||
```sh
|
||||
docker pull swaggerapi/swagger-ui
|
||||
docker run -p 80:8080 swaggerapi/swagger-ui
|
||||
```
|
||||
@@ -73,24 +73,36 @@ Will start nginx with Swagger UI on port 80.
|
||||
|
||||
Or you can provide your own swagger.json on your host
|
||||
|
||||
```
|
||||
```sh
|
||||
docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui
|
||||
```
|
||||
|
||||
You can also provide a URL to a swagger.json on an external host:
|
||||
|
||||
```
|
||||
```sh
|
||||
docker run -p 80:8080 -e SWAGGER_JSON_URL=https://petstore3.swagger.io/api/v3/openapi.json swaggerapi/swagger-ui
|
||||
```
|
||||
|
||||
The base URL of the web application can be changed by specifying the `BASE_URL` environment variable:
|
||||
|
||||
```
|
||||
```sh
|
||||
docker run -p 80:8080 -e BASE_URL=/swagger -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui
|
||||
```
|
||||
|
||||
This will serve Swagger UI at `/swagger` instead of `/`.
|
||||
|
||||
You can specify a different port via `PORT` variable for accessing the application, default is `8080`.
|
||||
|
||||
```sh
|
||||
docker run -p 80:80 -e PORT=80 swaggerapi/swagger-ui
|
||||
```
|
||||
|
||||
You can specify an IPv6 port via `PORT_IPV6` variable. By default, IPv6 port is not set.
|
||||
|
||||
```sh
|
||||
docker run -p 80:80 -e PORT_IPV6=8080 swaggerapi/swagger-ui
|
||||
```
|
||||
|
||||
For more information on controlling Swagger UI through the Docker image, see the Docker section of the [Configuration documentation](configuration.md#docker).
|
||||
|
||||
### unpkg
|
||||
|
||||
Reference in New Issue
Block a user