Skip to content

Commit

Permalink
ircd-exporter update
Browse files Browse the repository at this point in the history
  • Loading branch information
Tob1as committed Nov 4, 2024
1 parent 3588d77 commit 8d2acf9
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions ircd-exporter.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
# docker build --no-cache --progress=plain --build-arg GOLANG_VERSION=1.21 -t tobi312/tools:ircd-exporter -f Dockerfile .
ARG GOLANG_VERSION=1.21
FROM golang:${GOLANG_VERSION}-alpine as builder

#ENV GOPATH /go
ENV CGO_ENABLED 0
#ENV GO111MODULE on
# docker build --no-cache --progress=plain --build-arg GO_VERSION=1.23 -t tobi312/tools:ircd-exporter -f ircd-exporter.Dockerfile .
ARG GO_VERSION=1.23
FROM golang:${GO_VERSION}-alpine AS builder
ARG VERSION=master
ENV GOPATH=/go
ENV CGO_ENABLED=0

RUN \
apk add --no-cache git ; \
git clone https://github.com/dgl/ircd_exporter.git ./ircd_exporter ; \
cd ./ircd_exporter ; \
git clone --branch ${VERSION} --single-branch https://github.com/dgl/ircd_exporter.git ${GOPATH}/src/ircd_exporter ; \
cd ${GOPATH}/src/ircd_exporter ; \
go mod download ; \
cd ./cmd/ircd_exporter/ ; \
go build
cd ${GOPATH}/src/ircd_exporter/cmd/ircd_exporter/ ; \
go build -o ${GOPATH}/bin/ircd_exporter . ; \
${GOPATH}/bin/ircd_exporter --help


FROM scratch

ARG VCS_REF
ARG BUILD_DATE

ARG VERSION
LABEL org.opencontainers.image.title="ircd_exporter" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.description="Prometheus exporter for IRC server state" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/tools" \
org.opencontainers.image.source="https://github.com/dgl/ircd_exporter"

COPY --from=builder --chown=100:100 /go/ircd_exporter/cmd/ircd_exporter/ircd_exporter /usr/local/bin/ircd_exporter

USER 100:100
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.revision="${VCS_REF}" \
org.opencontainers.image.description="Prometheus exporter for IRC server state" \
org.opencontainers.image.documentation="https://github.com/dgl/ircd_exporter/issues/3" \
org.opencontainers.image.base.name="scratch" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://hub.docker.com/r/tobi312/tools" \
org.opencontainers.image.source="https://github.com/dgl/ircd_exporter"
COPY --from=builder --chown=1000:1000 /go/bin/ircd_exporter /usr/local/bin/ircd_exporter
USER 1000:1000
EXPOSE 9678/tcp
ENTRYPOINT ["ircd_exporter"]
#CMD ["--help"]
#CMD ["--help"]

0 comments on commit 8d2acf9

Please sign in to comment.