Skip to content

Commit

Permalink
Merge pull request #7 from mitchdraft/tweak-catalog-go-build-flags
Browse files Browse the repository at this point in the history
use multistage build, pass macos dwarf flag for local dev
  • Loading branch information
mcouliba authored May 7, 2019
2 parents 90a74a4 + 5c8ab06 commit c7c5f8a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions catalog-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

*.out
11 changes: 7 additions & 4 deletions catalog-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
FROM alpine:3.9
COPY --from=builder /go/src/app /app
WORKDIR /app
EXPOSE 8080
CMD ["/app/catalog-go"]
4 changes: 4 additions & 0 deletions catalog-go/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

.PHONY: compile-local
compile-local:
CGO_ENABLED=0 go build -gcflags "-N -l" -ldflags="-compressdwarf=false" -o catalog-go.out .

0 comments on commit c7c5f8a

Please sign in to comment.