All of the Dockerfiles were doing very similar things. Refactored to make use of buildkit multistage build (see this article for explanation). Thought there would be greater speedup but it went from ~2min20sec to ~1min30sec. Greatest advantage is cleanliness and maintainability. For eg with a single Dockerfile we can see the commonalities between the different targets and refactor as needed.
Also added a bake file with different targets. This replaces the docker compose files. Bake files are a new feature of docker which allows for grouping targets together. They also support extra useful features like inheritance, so easy to make release targets that add extra platforms for eg.
This refactor also makes it easier to inject into all images the same ldflags that we currently only inject into the node release build, but not into the nodeplugin or any other image. Easier to see patterns like this.
Testing
Have built the images manually successfully, but haven't done any testing with those images. Also haven't tested the pipeline changes that push to ghcr.
Why are these changes needed?
All of the Dockerfiles were doing very similar things. Refactored to make use of buildkit multistage build (see this article for explanation). Thought there would be greater speedup but it went from ~2min20sec to ~1min30sec. Greatest advantage is cleanliness and maintainability. For eg with a single Dockerfile we can see the commonalities between the different targets and refactor as needed.
Also added a bake file with different targets. This replaces the docker compose files. Bake files are a new feature of docker which allows for grouping targets together. They also support extra useful features like inheritance, so easy to make release targets that add extra platforms for eg.
This refactor also makes it easier to inject into all images the same ldflags that we currently only inject into the node release build, but not into the nodeplugin or any other image. Easier to see patterns like this.
Testing
Have built the images manually successfully, but haven't done any testing with those images. Also haven't tested the pipeline changes that push to ghcr.