Browse Source

Merge pull request #7 from arulrajnet/swagger-json-as-volume-support

Added support to load local swagger.json
pull/8/head
Johannes Schickling 9 years ago
parent
commit
e1941ff656
  1. 1
      swagger-ui/Dockerfile
  2. 13
      swagger-ui/docker-compose.yml
  3. 1
      swagger-ui/petstore-swagger.json
  4. 9
      swagger-ui/run.sh

1
swagger-ui/Dockerfile

@ -5,6 +5,7 @@ ENV VERSION "v2.1.3"
ENV FOLDER "swagger-ui-2.1.3"
ENV API_URL "http://petstore.swagger.io/v2/swagger.json"
ENV API_KEY "**None**"
ENV SWAGGER_JSON "/app/swagger.json"
WORKDIR /app

13
swagger-ui/docker-compose.yml

@ -0,0 +1,13 @@
swaggerui:
build: .
ports:
- 80:80
hostname: swaggerui
volumes:
- ./petstore-swagger.json:/app/swagger.json
swaggerui_novolume:
build: .
ports:
- 8080:80
hostname: swaggerui

1
swagger-ui/petstore-swagger.json
File diff suppressed because it is too large
View File

9
swagger-ui/run.sh

@ -8,7 +8,12 @@ if [ "$API_KEY" != "**None**" ]; then
sed -i "s|myApiKeyXXXX123456789|$API_KEY|g" index.html
fi
sed -i "s|http://petstore.swagger.io/v2/swagger.json|$API_URL|g" index.html
sed -i "s|http://example.com/api|$API_URL|g" index.html
if [[ -f $SWAGGER_JSON ]]; then
sed -i "s|http://petstore.swagger.io/v2/swagger.json|/swagger.json|g" index.html
sed -i "s|http://example.com/api|/swagger.json|g" index.html
else
sed -i "s|http://petstore.swagger.io/v2/swagger.json|$API_URL|g" index.html
sed -i "s|http://example.com/api|$API_URL|g" index.html
fi
http-server -p 80
Loading…
Cancel
Save