Skip to content

Commit a42e898

Browse files
authored
Merge pull request #850 from swagger-api/codegen-issue-8320
added docker file for go-server generator
2 parents e4153e3 + e75cb7c commit a42e898

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/main/java/io/swagger/codegen/v3/generators/go/GoServerCodegen.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public void processOpts() {
9898
* it will be processed by the template engine. Otherwise, it will be copied
9999
*/
100100
supportingFiles.add(new SupportingFile("swagger.mustache", "api", "swagger.yaml"));
101+
supportingFiles.add(new SupportingFile("Dockerfile", "", "Dockerfile"));
101102
supportingFiles.add(new SupportingFile("main.mustache", "", "main.go"));
102103
supportingFiles.add(new SupportingFile("routers.mustache", apiPath, "routers.go"));
103104
supportingFiles.add(new SupportingFile("logger.mustache", apiPath, "logger.go"));
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.10 AS build
2+
WORKDIR /go/src
3+
COPY go ./go
4+
COPY main.go .
5+
6+
ENV CGO_ENABLED=0
7+
RUN go get -d -v ./...
8+
9+
RUN go build -a -installsuffix cgo -o swagger .
10+
11+
FROM scratch AS runtime
12+
COPY --from=build /go/src/swagger ./
13+
EXPOSE 8080/tcp
14+
ENTRYPOINT ["./swagger"]

0 commit comments

Comments
 (0)