Skip to content

Commit

Permalink
Minimalize Dockerfile (#378)
Browse files Browse the repository at this point in the history
* Update Dockerfile

* Dockerfile: Building static binaries

* Dockerfile: Update entrypoint

* Update copy command

* remove debug info
  • Loading branch information
RaeesBhatti authored and mthenw committed Mar 2, 2018
1 parent d668383 commit c955490
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM golang:1.9-alpine as builder
RUN apk add --update git
RUN apk add ca-certificates

WORKDIR /go/src/github.com/serverless/event-gateway
COPY . .
Expand All @@ -11,11 +12,11 @@ RUN go get -u golang.org/x/net/http2
RUN go get -u golang.org/x/net/trace
RUN go get -u github.com/golang/dep/cmd/dep
RUN dep ensure
RUN go build -o event-gateway cmd/event-gateway/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags '-w -s' -a -installsuffix cgo -o event-gateway cmd/event-gateway/main.go

FROM alpine:3.6
RUN apk add --no-cache ca-certificates
WORKDIR /app/
COPY --from=builder /go/src/github.com/serverless/event-gateway/event-gateway .
FROM scratch
WORKDIR /
COPY --from=builder /go/src/github.com/serverless/event-gateway/event-gateway /
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
EXPOSE 4000 4001
ENTRYPOINT ["./event-gateway"]
ENTRYPOINT ["/event-gateway"]

0 comments on commit c955490

Please sign in to comment.