ambient-local-exporter/Dockerfile
2025-01-04 21:11:11 -05:00

24 lines
581 B
Docker

FROM golang:1-alpine AS build
WORKDIR /app
ENV GO111MODULE=auto CGO_ENABLED=0 GOOS=linux
ARG GOPROXY
ARG GONOSUMDB=gitea.libretechconsulting.com
ARG VERSIONPATH=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 ${VERSIONPATH}=${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" ]