https://github.com/danielgtaylor/huma-build
Docker build utility for Huma REST OpenAPI projects
https://github.com/danielgtaylor/huma-build
Last synced: 11 months ago
JSON representation
Docker build utility for Huma REST OpenAPI projects
- Host: GitHub
- URL: https://github.com/danielgtaylor/huma-build
- Owner: danielgtaylor
- License: mit
- Created: 2020-03-18T04:47:36.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-18T04:48:21.000Z (over 6 years ago)
- Last Synced: 2024-10-05T22:03:39.895Z (almost 2 years ago)
- Language: Go
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Huma Build
A Docker build helper for [Huma](https://github.com/danielgtaylor/huma).
## Features
- Builds your Huma-based service using Alpine
- Optionally generates a CLI using [openapi-cli-generator](https://github.com/danielgtaylor/openapi-cli-generator)
- Optionally generates SDKs using [openapi-generator](https://openapi-generator.tech/)
- See [available generators](https://openapi-generator.tech/docs/generators#client-generators)
## Usage
Usage requires two files: a `.huma.yaml` configuration and a `Dockerfile`. Examples:
```yaml
service: your-service
command: go test && go install
cli:
name: your-service-cli
command: go build
sdk-languages:
- go
- python
- javascript
```
Note that CLI support requires a `cli` folder with a `main.go` that generates all needed code via `go generate`.
```Dockerfile
FROM danielgtaylor/huma-build as build
COPY . .
RUN huma-build
FROM alpine as deploy
WORKDIR /service
COPY --from=build /go/bin/your-service /usr/bin/
COPY --from=build /huma/out/*.zip ./downloads/
ENTRYPOINT ["your-service"]
```
You can then build and run the service!
```sh
# Build it!
$ docker build -t your-service .
# Run it!
$ docker run your-service
```
Check it out at http://localhost:8888/docs.