Skip to content

Commit

Permalink
use multistage build, pass macos dwarf flag for local dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Mitch Kelley committed May 5, 2019
1 parent c21c917 commit 5c8ab06
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 5c8ab06

Please sign in to comment.