Skip to content

Commit

Permalink
Merge pull request #19 from segmentio/mod_and_dockerfile_update
Browse files Browse the repository at this point in the history
moved to go modules and moved to scratch image
  • Loading branch information
pooyaj authored Jun 16, 2020
2 parents 519f92e + 3734d5d commit 05d9ad7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
FROM golang:onbuild
FROM golang:1.14.4-alpine3.11 as builder

RUN apk add --update ca-certificates git

ENV SRC github.com/segmentio/segment-proxy
ENV CGO_ENABLED=0
ENV GO111MODULE=on
ENV GOOS=linux
ENV GOARCH=amd64

ARG VERSION

COPY . /go/src/${SRC}
WORKDIR /go/src/${SRC}

RUn go build -a -installsuffix cgo -ldflags "-w -s -extldflags '-static' -X main.version=$VERSION" -o /proxy

FROM scratch

COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /proxy /proxy

EXPOSE 8080

ENTRYPOINT ["/proxy"]
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/segmentio/segment-proxy

go 1.13

require github.com/gorilla/handlers v0.0.0-20160228171604-ee54c7b44cab

0 comments on commit 05d9ad7

Please sign in to comment.