From bec623cd682bdd84355ec6a6dce9ebb4b37eb424 Mon Sep 17 00:00:00 2001 From: Oleg Balunenko Date: Tue, 7 Jan 2025 18:16:49 +0400 Subject: [PATCH] feat: Add labels to docker image --- Makefile | 2 +- README.md | 6 +++--- docker-bake.hcl | 14 +++++++++++++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f380a6251..03f073cbe 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ help: ## Build docker images. build: - docker buildx bake + IMAGE_DESCRIPTION="$$(cat README.md)" docker buildx bake .PHONY: build ## Sync vendor. diff --git a/README.md b/README.md index 0088da98c..4a33dc3d9 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,12 @@ The base image is built on top of the official image [golang:1.23.4-alpine3.21]( | [buf](https://github.com/bufbuild/buf) | v1.48.0 | The buf CLI is the best tool for working with Protocol Buffers | | [coverbadger](https://github.com/obalunenko/coverbadger) | v1.4.0 | Generate coverage badge images for Markdown files using Go | | [enumer](https://github.com/alvaroloes/enumer) | v1.1.2 | A Go tool to auto generate methods for your enums | -| [fiximports](https://golang.org/x/tools/cmd/fiximports) | v0.28.0 | The fiximports command fixes import declarations to use the canonical import path for packages that have an "import comment" as defined by https://golang.org/s/go14customimport. | +| [fiximports](https://golang.org/x/tools/cmd/fiximports) | v0.29.0 | The fiximports command fixes import declarations to use the canonical import path for packages that have an "import comment" as defined by https://golang.org/s/go14customimport. | | [go-enum](https://github.com/abice/go-enum) | v0.6.0 | An enum generator for go | | [gocov](https://github.com/axw/gocov) | v1.2.1 | Coverage testing tool for The Go Programming Language | | [gocov-html](https://github.com/matm/gocov-html) | v1.4.0 | Make pretty HTML output from gocov, a coverage testing tool for Go | | [gofumpt](https://mvdan.cc/gofumpt) | v0.7.0 | A stricter gofmt | -| [goimports](https://golang.org/x/tools/cmd/goimports) | v0.28.0 | Command goimports updates your Go import lines, adding missing ones and removing unreferenced ones | +| [goimports](https://golang.org/x/tools/cmd/goimports) | v0.29.0 | Command goimports updates your Go import lines, adding missing ones and removing unreferenced ones | | [golangci-lint](https://github.com/golangci/golangci-lint) | v1.62.2 | Fast linters Runner for Go | | [goose](https://github.com/pressly/goose/v3/cmd/goose) | v3.24.0 | A database migration tool | | [goreadme](https://github.com/posener/goreadme) | v1.4.2 | Generate readme file from Go doc | @@ -40,7 +40,7 @@ The base image is built on top of the official image [golang:1.23.4-alpine3.21]( | [goveralls](https://github.com/mattn/goveralls) | v0.0.12 | Go integration for Coveralls.io continuous code coverage tracking system. | | [govulncheck](https://golang.org/x/vuln/cmd/govulncheck) | v1.1.3 | Govulncheck reports known vulnerabilities that affect Go code. | | [pkgsite](https://golang.org/x/pkgsite/cmd/pkgsite) | v0.0.0-20241216215327-06c6edf28e6c | Pkgsite extracts and generates documentation for Go programs. It runs as a web server and presents the documentation as a web page. | -| [stringer](https://golang.org/x/tools/cmd/stringer) | v0.28.0 | Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer interface. | +| [stringer](https://golang.org/x/tools/cmd/stringer) | v0.29.0 | Stringer is a tool to automate the creation of methods that satisfy the fmt.Stringer interface. | | [svu](https://github.com/caarlos0/svu) | v2.2.0 | Semantic Version Util | | [swag](github.com/swaggo/swag/cmd/swag) | v1.16.4 | Automatically generate RESTful API documentation with Swagger 2.0 for Go | | [swagger](https://github.com/go-swagger/go-swagger) | v0.31.0 | Client/Server from OpenAPI docs generation tool | diff --git a/docker-bake.hcl b/docker-bake.hcl index 774a2ab73..8ea57d134 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -16,11 +16,23 @@ variable "IMAGE_WITH_REGISTRY" { default = notequal("",REGISTRY) ? "${REGISTRY}/${IMAGE_NAME}": "${IMAGE_NAME}" } +variable "IMAGE_TITLE" { + default = "Go Tools" +} + +variable "IMAGE_DESCRIPTION" { + default = "" +} + target "docker-metadata-action" {} target "gotools-latest" { inherits = ["docker-metadata-action"] dockerfile = "Dockerfile" - context= "." + context = "." platforms = ["linux/amd64", "linux/arm64"] + labels = { + "org.opencontainers.image.title" = "${IMAGE_TITLE}" + "org.opencontainers.image.description" = "${IMAGE_DESCRIPTION}" + } } \ No newline at end of file