FROM golang:1-alpine AS build WORKDIR /app ENV GO111MODULE=auto CGO_ENABLED=0 GOOS=linux ARG GOPROXY ARG GONOSUMDB=gitea.libretechconsulting.com ARG VER_PKG=gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version ARG VERSION=(devel) COPY ./go.mod ./go.sum ./ RUN go mod download COPY ./ /app RUN go build -C . -v -ldflags "-extldflags '-static' -X ${VER_PKG}=${VERSION}" -o ambient-local-exporter . FROM alpine:latest WORKDIR /app USER 100:101 COPY --from=build --chown=100:101 /app/ambient-local-exporter /app/ ENTRYPOINT [ "/app/ambient-local-exporter" ]