-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (24 loc) · 1.12 KB
/
Dockerfile
File metadata and controls
34 lines (24 loc) · 1.12 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
FROM --platform=$BUILDPLATFORM golang:1.25.5-alpine3.21@sha256:b4dbd292a0852331c89dfd64e84d16811f3e3aae4c73c13d026c4d200715aff6 AS builder
RUN apk add --no-cache -U git curl
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
WORKDIR /go/src/exporter
COPY . /go/src/exporter/
RUN --mount=type=cache,target=/go/pkg \
go mod download -x
ARG TARGETOS
ARG TARGETARCH
RUN --mount=type=cache,target=/go/pkg \
--mount=type=cache,target=/root/.cache/go-build \
task generate build GOOS=${TARGETOS} GOARCH=${TARGETARCH}
FROM alpine:3.23@sha256:5b10f432ef3da1b8d4c7eb6c487f2f5a8f096bc91145e68878dd4a5019afde11
RUN apk add --no-cache ca-certificates mailcap && \
addgroup -g 1337 exporter && \
adduser -D -u 1337 -h /var/lib/exporter -G exporter exporter
EXPOSE 9504
VOLUME ["/var/lib/exporter"]
ENTRYPOINT ["/usr/bin/github_exporter"]
HEALTHCHECK CMD ["/usr/bin/github_exporter", "health"]
ENV GITHUB_EXPORTER_DATABASE_DSN=sqlite:///var/lib/exporter/database.sqlite3
COPY --from=builder /go/src/exporter/bin/github_exporter /usr/bin/github_exporter
WORKDIR /var/lib/exporter
USER exporter