iamseth / oracledb_exporter

Prometheus Oracle database exporter.
MIT License
472 stars 242 forks source link

Publish Docker images based on the "scratch" base image #438

Closed HansK-p closed 2 months ago

HansK-p commented 2 months ago

I'm submitting a ...

What is the current behavior?

Currently Docker images are created based on the following base images:

What is the expected behavior?

With the change to a pure Golang based Oracle driver, it is now possible to create an oracle_exporter Docker image based on the scratch base image.

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

We have tested building and running images from scratch, and this seems to work well. The resulting container size is 27MB. For our use case we use a multistage build where the following extra files are added to the scratch image (extract from Dockerfile):

...
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -ldflags "-X main.Version=${VERSION} -s -w"
...
FROM alpine:3.19 as extras
RUN apk add -U --no-cache ca-certificates tzdata
...
COPY --from=extras /usr/share/zoneinfo                /usr/share/zoneinfo
COPY --from=extras /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
..

I' assume it should be easy to add scratch as a new base image. I'm a bit unsure as to if it is as easy to add TZ info and SSL certs, but that is also something we can do ourselves by creating our container image based on the published oracle_exporter image.

To be honest, I'm not even 100% sure we need TZ info or SSL certs as we haven't tested rrunning the scratch bases image without those extras.

I could try to create a PR (and might be I will) - in which case I will also check if we need those extras for our use case.