-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/docker volumes #3652
Feature/docker volumes #3652
Conversation
README.md
Outdated
You can pull a pre-built docker image of the swagger-ui directly from Dockerhub: | ||
|
||
``` | ||
docker pull swaggerapi/swagger-ui | ||
docker run -p 80:8080 swaggerapi/swagger-ui | ||
docker run -p 1337:8080 swaggerapi/swagger-ui |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it at port 80.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I've updated the PR based on your feedback @webron |
sed -i "s|http://example.com/api|$API_URL|g" $INDEX_FILE | ||
fi | ||
|
||
if [[ -f "$SPEC_DIR/$SWAGGER_JSON" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a duplicate if
statement?
|
||
``` | ||
docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui | ||
docker run -p 80:8080 -e "SWAGGER_JSON=swagger.json" -v /MyProject/spec/:/usr/share/nginx/html/spec/ swaggerapi/swagger-ui |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mounting the whole /usr/share/.../spec
is long, And given the docker run -p 80:8080 -e "SWAGGER_JSON=/spec/swagger.json" -v /MyProject/spec/:/spec/ swaggerapi/swagger-ui
example below. Which only mount /spec
. I feel we should combine these two.
My suggestion is we add another nginx root. That will look inside /spec
and default to /spec/swagger.{yaml|json}
Something as simple as
location /spec {
index swagger.yaml swagger.json; # The index file may/may-not work. And is only a nice to have.
root /spec
}
This means we just need to update the URL inside the index.html file to point to /spec
or /spec/$SWAGGER_JSON
. And we don't need to copy files over to /usr/share/nginx/...
So the examples become...
docker run -p 80:8080 -v /MyProject/spec:/spec swaggerapi/swagger-ui # Will use /MyProject/spec/swagger.json file ( $refs will be supported too, since this is the whole folder )
docker run -p 80:8080 -v -e "SWAGGER_JSON=petstore.yaml" /MyProject/spec:/spec swaggerapi/swagger-ui # Will use /MyProject/spec/petstore.yaml
The idea is only have one volume command. Less moving parts.
@guidsen let me know your thoughts on this. Or if anything I said was vague. And thank you for your efforts!
@shockey There is a proposed enhancement, but I don't feel it should block anything. |
@@ -21,7 +22,6 @@ replace_or_delete_in_index () { | |||
fi | |||
} | |||
|
|||
replace_in_index myApiKeyXXXX123456789 $API_KEY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that this apiKey functionality was removed in this PR - am I missing something? If not, why was it removed?
Closing; never heard back about my review. Happy to reopen this if you're still interested in having the feature merged, @guidsen! |
Regarding my suggestion on #3348 (comment).
This Pull Request will add Docker volume support. Let me know if there are any questions.