Skip to content

Commit 463b440

Browse files
authored
Fix swagger deployment (#179)
* Fix swagger container args to use spec from values specified in helm values * Merlin serve swagger.yaml instead of relying on the github Co-authored-by: Tio Pramayudi <[email protected]>
1 parent 5462e81 commit 463b440

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ WORKDIR /src/api
2424
COPY api .
2525
COPY python/batch-predictor ../python/batch-predictor
2626
COPY db-migrations ./db-migrations
27+
COPY swagger.yaml ./swagger.yaml
2728

2829
RUN go build -o bin/merlin_api ./cmd/api
2930

@@ -43,6 +44,7 @@ FROM alpine:3.12
4344

4445
COPY --from=go-builder /src/api/bin/merlin_api /usr/bin/merlin_api
4546
COPY --from=go-builder /src/api/db-migrations ./db-migrations
47+
COPY --from=go-builder /src/api/swagger.yaml ./swagger.yaml
4648
COPY --from=node-builder /src/ui/build ./ui/build
4749

4850
CMD ["merlin_api"]

api/cmd/api/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ func main() {
102102
mount(router, "/metrics", promhttp.Handler())
103103
mount(router, "/debug", newPprofRouter())
104104

105+
router.Path("/swagger.yaml").HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
106+
http.ServeFile(w, r, cfg.SwaggerPath)
107+
})
108+
105109
reactConfig := cfg.ReactAppConfig
106110
uiEnv := uiEnvHandler{
107111
OauthClientID: reactConfig.OauthClientID,

api/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type Config struct {
3737
NewRelic newrelic.Config `envconfig:"NEWRELIC" split_words:"false" `
3838
EnvironmentConfigPath string `envconfig:"DEPLOYMENT_CONFIG_PATH" required:"true"`
3939
NumOfQueueWorkers int `envconfig:"NUM_OF_WORKERS" default:"2"`
40+
SwaggerPath string `envconfig:"SWAGGER_PATH" default:"./swagger.yaml"`
4041

4142
DbConfig DatabaseConfig
4243
VaultConfig VaultConfig

0 commit comments

Comments
 (0)