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