1
0
Fork 0
email-collector/Dockerfile

37 lines
754 B
Docker
Raw Permalink Normal View History

2019-03-24 23:44:00 +08:00
FROM golang:1.12-alpine as build
2018-07-01 16:50:34 +08:00
2018-09-17 12:05:51 +08:00
# args
2019-03-24 23:44:00 +08:00
ARG version="1.0.2"
2018-09-17 12:05:51 +08:00
ARG repo="github.com/productionwentdown/email-collector"
2018-07-01 16:50:34 +08:00
2018-09-17 12:05:51 +08:00
# dependencies
2018-09-17 09:52:23 +08:00
RUN apk add --no-cache ca-certificates
2018-07-01 15:59:34 +08:00
2018-09-17 12:05:51 +08:00
# source
WORKDIR $GOPATH/src/${repo}
2018-07-01 15:52:51 +08:00
COPY . .
2018-09-17 12:05:51 +08:00
# build
2018-07-01 15:52:51 +08:00
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
2018-09-17 12:05:51 +08:00
RUN go build -ldflags "-s -w" -o /email-collector
2018-07-01 16:50:34 +08:00
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-09-17 12:05:51 +08:00
ARG version
# labels
LABEL org.label-schema.vcs-url="https://github.com/productionwentdown/email-collector"
LABEL org.label-schema.version=${version}
LABEL org.label-schema.schema-version="1.0"
# copy binary and ca certs
COPY --from=build /email-collector /email-collector
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
2018-07-01 15:52:51 +08:00
EXPOSE 8080
ENTRYPOINT ["/email-collector"]