-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
34 lines (25 loc) · 1.15 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.22.3 as builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG APP_VERSION
WORKDIR /app/
ADD . .
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-s -w -X 'main.version=${APP_VERSION}'" -o exporter main.go
FROM --platform=${TARGETPLATFORM:-linux/amd64} scratch
ARG DATE_CREATED
ARG APP_VERSION
ENV APP_VERSION=$APP_VERSION
LABEL org.opencontainers.image.created=$DATE_CREATED
LABEL org.opencontainers.version="$APP_VERSION"
LABEL org.opencontainers.image.authors="Arash Hatami <[email protected]>"
LABEL org.opencontainers.image.vendor="Arash Hatami"
LABEL org.opencontainers.image.title="netflow-exporter"
LABEL org.opencontainers.image.description="Prometheus exporter for NetFlow"
LABEL org.opencontainers.image.source="https://github.com/hatamiarash7/netflow-exporter"
LABEL org.opencontainers.image.url="https://github.com/hatamiarash7/netflow-exporter"
LABEL org.opencontainers.image.documentation="https://github.com/hatamiarash7/netflow-exporter"
WORKDIR /app/
COPY --from=builder /app/exporter /app/exporter
ENTRYPOINT ["/app/exporter"]