botkube/.goreleaser.yml
Prasad Ghangal f349853c51
Publish multi-arch images with goreleaser (#509)
##### ISSUE TYPE
 - Feature Pull Request

##### SUMMARY
- Switch to goreleaser for building and publishing release
- Set BotKube version with build args
- Use docker manifest to build multi-arch image
- Update CI pipeline to build and push image using goreleaser

Fixes #504 

```
$ docker manifest inspect ghcr.io/prasadg193/botkube:latest
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
   "manifests": [
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1370,
         "digest": "sha256:64d94709256eb85452afa06aa15574724266fa6b82b70654ff6b03c467d5a5e4",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1160,
         "digest": "sha256:525d79e629637fd1ae3530223fa380aea26ed299a1fd9ae2787721f4cc33dad5",
         "platform": {
            "architecture": "amd64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1160,
         "digest": "sha256:ef72bc09078929c8aed1161f86c2c86523f6fac664094a034c737ffd582f3ea7",
         "platform": {
            "architecture": "arm64",
            "os": "linux"
         }
      },
      {
         "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
         "size": 1160,
         "digest": "sha256:990cd2c6b522a3a69ba73ee83ed0ae306102369f02d09891de8fbfd024d37e87",
         "platform": {
            "architecture": "arm",
            "os": "linux",
            "variant": "v7"
         }
      }
   ]
}

```
2021-08-19 10:56:22 +05:30

59 lines
1.4 KiB
YAML

before:
hooks:
- go mod download
builds:
- id: botkube
binary: botkube
main: cmd/botkube/main.go
ldflags: &ldflags
- -s -w
-X github.com/infracloudio/botkube/pkg/version.Version={{ .Tag }}
-X github.com/infracloudio/botkube/pkg/version.GitCommitID={{ .Commit }}
-X github.com/infracloudio/botkube/pkg/version.BuildDate={{ .Date }}
env:
- CGO_ENABLED=0
goos:
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 7
snapshot:
name_template: "{{ .Tag }}"
changelog:
skip: true
dockers:
- image_templates:
- 'ghcr.io/infracloudio/botkube:{{ .Tag }}-amd64'
use: buildx
dockerfile: 'build/Dockerfile'
build_flag_templates:
- "--platform=linux/amd64"
- "--build-arg=botkube_version={{ .Tag }}"
- image_templates:
- 'ghcr.io/infracloudio/botkube:{{ .Tag }}-arm64'
use: buildx
goarch: arm64
dockerfile: 'build/Dockerfile'
build_flag_templates:
- "--platform=linux/arm64"
- "--build-arg=botkube_version={{ .Tag }}"
- image_templates:
- 'ghcr.io/infracloudio/botkube:{{ .Tag }}-armv7'
use: buildx
goarch: arm
goarm: 7
dockerfile: 'build/Dockerfile'
build_flag_templates:
- "--platform=linux/arm"
- "--build-arg=botkube_version={{ .Tag }}"
docker_manifests:
- name_template: ghcr.io/infracloudio/botkube:{{ .Tag }}
image_templates:
- ghcr.io/infracloudio/botkube:{{ .Tag }}-amd64
- ghcr.io/infracloudio/botkube:{{ .Tag }}-arm64
- ghcr.io/infracloudio/botkube:{{ .Tag }}-armv7