kingdonb / stats-tracker-ghcr

Tracking GHCR download counts for FluxCD
0 stars 0 forks source link

Docker build #15

Closed kingdonb closed 1 year ago

kingdonb commented 1 year ago

The intent is to build an image that we can run in Kubernetes, for #11

We need both Ruby and Rust in the build image. There is no attempt made to remove build tools from the runtime image.

kingdonb commented 1 year ago

It works now, docker.io/kingdonb/opernator:latest has the output of make docker

There's rudimentary (at least) Gemfile caching, and it's possible to rebuild without fetching all the gems again. It's not quite orchestrated by CI yet, this is a mashup of https://blog.saeloun.com/2022/07/12/docker-cache/ and https://codetales.io/blog/speeding-up-bundler-in-dockerized-environments which it seems to maybe have been based on.

It's basically make base, make gems and make gem-cache, which in turn makes make gems faster, and both cause make docker to be faster. You can set IMAGE to ghcr.io/kingdonb/stats-tracker-ghcr in the GitHub Action workflow, then just ensure that all of those things have a workflow_dispatch config so they can be triggered manually in the proper order and from the main branch.

We can crank up caching once it's on GitHub, I've just built these images locally with Docker (Rancher Desktop) to be sure it works before the merge 👍