-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (29 loc) · 1.04 KB
/
Copy pathDockerfile
File metadata and controls
43 lines (29 loc) · 1.04 KB
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
35
36
37
38
39
40
41
42
43
# Build Stage
FROM golang:1.26-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build \
-a -installsuffix cgo \
-ldflags="-w -s" \
-o github-exporter
# Run Stage - using pinned alpine version
FROM alpine:3.23
# Install CA certificates (required for HTTPS calls to GitHub API)
RUN apk add --no-cache ca-certificates
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/github-exporter .
# Add OCI labels for metadata
LABEL org.opencontainers.image.title="github-exporter" \
org.opencontainers.image.description="Prometheus exporter for GitHub metrics" \
org.opencontainers.image.source="https://github.com/eleboucher/github-exporter" \
org.opencontainers.image.licenses="Apache-2.0"
# Run as non-root user
USER nobody:nogroup
ENTRYPOINT ["/app/github-exporter"]
CMD ["--config", "/config/config.yaml"]