blackstork-io / fabric

An open-source command-line tool for reporting workflow automation and a configuration language for reusable templates. Reporting-as-Code
https://blackstork.io/fabric/
Apache License 2.0
10 stars 0 forks source link

Simple dockerfile #153

Closed Andrew-Morozko closed 3 weeks ago

Andrew-Morozko commented 1 month ago

I started working on a full dockerization of the project, but goreleaser was throwing some strange errors like

11.69 go: github.com/blackstork-io/fabric imports
11.69   github.com/blackstork-io/fabric/cmd: no matching versions for query "latest"

And I thought that since we already have the built artifacts - why not just reuse them? Here's a simple dockerfile that just downloads the latest release from github. Is this enough, or should it build the binary from scratch?

dobarx commented 1 month ago

Why not to just use goreleaser? It copies already built binary to the image. Or did you receive this error by attempting to run goreleaser during docker image build phase?

Note that we are not building any go files in the Docker build phase, we are merely copying the binary to a scratch image and setting up the entrypoint. https://goreleaser.com/customization/docker/

dobarx commented 1 month ago

Also, we should probably build image that supports multiple platforms and archs.

Andrew-Morozko commented 1 month ago

Why not to just use goreleaser?

Ah! Didn't think about it 😅. Will do)

Andrew-Morozko commented 1 month ago

Ok, I've set up the workflow with Goreleacer.

Unfortunately, it's a bit ugly: we first must build and push each platform-specific version (I named them something like latest-amd64v1) before combining them via manifest into a single tag like "{{ .Version }}" or "latest".

It's possible to do this without these extra versions, but I can't find a way to extract the hashes out of the "dockers" build step to use them instead of tags in "docker_manifests".

I make multiplatform builds only for linux/386, linux/amd64 and linux/arm64