38 lines
743 B
Docker
38 lines
743 B
Docker
FROM golang:1.11-alpine as build
|
|
|
|
# args
|
|
ARG version="0.1"
|
|
ARG repo="git.makerforce.io/cacti/he-dns-editor"
|
|
|
|
# dependencies
|
|
RUN apk add --no-cache ca-certificates git
|
|
|
|
# source
|
|
WORKDIR $GOPATH/src/${repo}
|
|
COPY . .
|
|
|
|
# build
|
|
ENV CGO_ENABLED=0
|
|
ENV GOOS=linux
|
|
ENV GOARCH=amd64
|
|
RUN go get
|
|
RUN go build -ldflags "-s -w" -o /he-dns-editor
|
|
|
|
|
|
FROM scratch
|
|
|
|
ARG version
|
|
|
|
# labels
|
|
LABEL org.label-schema.vcs-url="https://git.makerforce.io/cacti/he-dns-editor"
|
|
LABEL org.label-schema.version=${version}
|
|
LABEL org.label-schema.schema-version="1.0"
|
|
|
|
# copy binary and ca certs
|
|
COPY --from=build /he-dns-editor /he-dns-editor
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
EXPOSE 8080
|
|
|
|
ENTRYPOINT ["/he-dns-editor"]
|