How do we containerize Goa apps properly? #3282
-
I'm having trouble figuring out how to write a Dockerfile in order to containerize a Goa application. As far as I can tell, the entry point to launch the server is the extensionless file generated when I run 'go build' inside my 'cmd/' directory. However, I'm unsure how to set up the port mapping for the Docker container. I'm also a bit confused about how I should package and distribute the CLI tool generated in the quickstart example. It would be nice if there was an example of this in the examples repo. Should I put in a feature request over there for that or am I over complicating things? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I don't think there is anything GOA specific here and there are many examples to go off of.
|
Beta Was this translation helpful? Give feedback.
-
With that being said, generating OpenAPI is the core feature of GOA that most frameworks don't support well. If you want to serve these from your service you would need to add it to your Dockerfile, something like: # design/design.go
Files("/openapi.json", "./gen/http/openapi.json")
Files("/openapi3.json", "./gen/http/openapi3.json")
Files("/swagger-ui/{*filepath}", "./assets/swagger-ui", # Dockerfile
ADD ./assets ./assets # for an OpenAPI GUI assets/swagger-ui
ADD ./gen/http/openapi.json ./gen/http/openapi.json
ADD ./gen/http/openapi3.json ./gen/http/openapi3.json
ADD ./gen/http/openapi.yaml ./gen/http/openapi.yaml
ADD ./gen/http/openapi3.yaml ./gen/http/openapi3.yaml |
Beta Was this translation helpful? Give feedback.
I don't think there is anything GOA specific here and there are many examples to go off of.