diff --git a/catalog-go/.gitignore b/catalog-go/.gitignore new file mode 100644 index 0000000..e9e2c28 --- /dev/null +++ b/catalog-go/.gitignore @@ -0,0 +1,2 @@ + +*.out \ No newline at end of file diff --git a/catalog-go/Dockerfile b/catalog-go/Dockerfile index 5eb7a7e..758ba86 100644 --- a/catalog-go/Dockerfile +++ b/catalog-go/Dockerfile @@ -1,9 +1,12 @@ -FROM golang:1.12 - +FROM golang:1.12 as builder WORKDIR /go/src/app COPY . /go/src/app RUN go get -d -v ./... -RUN go install -v ./... +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags "-N -l" -ldflags="-compressdwarf=false" -o catalog-go . -CMD ["app"] \ No newline at end of file +FROM alpine:3.9 +COPY --from=builder /go/src/app /app +WORKDIR /app +EXPOSE 8080 +CMD ["/app/catalog-go"] \ No newline at end of file diff --git a/catalog-go/Makefile b/catalog-go/Makefile new file mode 100644 index 0000000..b4ffb2e --- /dev/null +++ b/catalog-go/Makefile @@ -0,0 +1,4 @@ + +.PHONY: compile-local +compile-local: + CGO_ENABLED=0 go build -gcflags "-N -l" -ldflags="-compressdwarf=false" -o catalog-go.out .