1
0
Fork 0
email-collector/Dockerfile

29 lines
520 B
Docker
Raw Normal View History

2018-07-01 16:50:34 +08:00
ARG name="email-collector"
ARG repo="github.com/productionwentdown/${name}"
2018-07-01 15:52:51 +08:00
FROM golang:1.10-alpine as go
2018-09-17 09:52:23 +08:00
RUN apk add --no-cache ca-certificates
2018-07-01 16:50:34 +08:00
ARG name
ARG repo
2018-07-01 15:59:34 +08:00
WORKDIR /go/src/${repo}
2018-07-01 15:52:51 +08:00
COPY . .
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
2018-07-01 16:50:34 +08:00
RUN go build -ldflags '-extldflags "-static"' -o ${name}
2018-07-01 15:52:51 +08:00
2018-09-17 09:52:23 +08:00
FROM scratch
2018-07-01 15:52:51 +08:00
2018-07-01 16:50:34 +08:00
ARG name
ARG repo
2018-07-01 15:52:51 +08:00
EXPOSE 8080
2018-09-17 09:52:23 +08:00
COPY --from=go /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
2018-07-01 16:50:34 +08:00
COPY --from=go /go/src/${repo}/${name} /${name}
2018-07-01 15:52:51 +08:00
ENTRYPOINT ["/email-collector"]