Skip to content

Commit 05d9ad7

Browse files
authored
Merge pull request #19 from segmentio/mod_and_dockerfile_update
moved to go modules and moved to scratch image
2 parents 519f92e + 3734d5d commit 05d9ad7

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

Dockerfile

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
FROM golang:onbuild
1+
FROM golang:1.14.4-alpine3.11 as builder
2+
3+
RUN apk add --update ca-certificates git
4+
5+
ENV SRC github.com/segmentio/segment-proxy
6+
ENV CGO_ENABLED=0
7+
ENV GO111MODULE=on
8+
ENV GOOS=linux
9+
ENV GOARCH=amd64
10+
11+
ARG VERSION
12+
13+
COPY . /go/src/${SRC}
14+
WORKDIR /go/src/${SRC}
15+
16+
RUn go build -a -installsuffix cgo -ldflags "-w -s -extldflags '-static' -X main.version=$VERSION" -o /proxy
17+
18+
FROM scratch
19+
20+
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
21+
COPY --from=builder /proxy /proxy
22+
223
EXPOSE 8080
24+
25+
ENTRYPOINT ["/proxy"]

go.mod

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module github.com/segmentio/segment-proxy
2+
3+
go 1.13
4+
5+
require github.com/gorilla/handlers v0.0.0-20160228171604-ee54c7b44cab

0 commit comments

Comments
 (0)