Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codfish/swagger-docker
Docker image for swagger documentation app.
https://github.com/codfish/swagger-docker
docker swagger swagger-ui
Last synced: about 1 month ago
JSON representation
Docker image for swagger documentation app.
- Host: GitHub
- URL: https://github.com/codfish/swagger-docker
- Owner: codfish
- License: mit
- Created: 2019-03-17T17:36:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-26T11:40:00.000Z (almost 4 years ago)
- Last Synced: 2024-10-27T15:44:22.917Z (3 months ago)
- Topics: docker, swagger, swagger-ui
- Language: JavaScript
- Homepage: https://hub.docker.com/r/codfish/swagger
- Size: 1.8 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# swagger-docker
Docker image for visually rendering documentation for an API defined with the OpenAPI (Swagger)
Specification. Simply mount over the `/app/swagger.yaml` file with your OpenAPI spec and you'll have
a Swagger UI to view & interact with in seconds.Reason for building this image is because the
[native swagger-ui image](https://hub.docker.com/r/swaggerapi/swagger-ui/) doesn't support YAML, and
I personally prefer writing OpenAPI documentation in YAML.- [Usage](#usage)
- [With `dotdocker`](#with-dotdocker)
- [Reference](#reference)
- [Todo](#todo)## Usage
> NOTE: Only YAML is supported _currently_.
Simply mount over `/app/swagger.yaml` with your local api spec. Example `docker-compose.yml` file:
```yaml
version: '3'services:
docs:
image: codfish/swagger
command: npm run dev
ports:
- '10010:10010'
volumes:
- ./my-api-spec.yaml:/app/swagger.yaml:delegated
```This will make your swagger ui docs available at `http://localhost:10010`.
### With `dotdocker`
If you're interested in getting a fancy \*.docker url and not worrying about port collisions across
projects check out [dotdocker](https://github.com/aj-may/dotdocker). Instead of having to expose a
port and view the docs at `localhost:10010` for example, you can do this instead:```yaml
version: '3'services:
docs:
image: codfish/swagger
command: npm run dev
volumes:
- ./my-api-spec.yaml:/app/swagger.yaml:delegated
environment:
VIRTUAL_HOST: docs.my-api.docker
```1. `brew install aj-may/dotdocker/dotdocker`
2. `sudo dotdocker start`
3. Add `VIRTUAL_HOST` environment variable to any docker service.That's it! You can visit the docs at `http://docs.my-api.docker/`.
## Reference
- **OpenAPI Specification:**
## Todo
- [ ] Support multiple file types
- [ ] Add `docker` command example to readme
- [ ] Add support for swagger-ui options