Merge pull request #38 from hikhvar/build-multi-arch-images

Multi arch build
This commit is contained in:
Christoph Petrausch
2021-02-03 13:06:17 +01:00
committed by GitHub
3 changed files with 169 additions and 7 deletions

View File

@@ -21,6 +21,10 @@ jobs:
run: go test -cover ./...
- name: Vet
run: go vet ./...
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# Login to the registries
- name: Login to Github Packages
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
@@ -29,10 +33,15 @@ jobs:
# Github Registry does not support the github actions token
- name: Login to Github Registry
run: echo ${{secrets.PERSONAL_ACCESS_TOKEN }} | docker login ghcr.io -u hikhvar --password-stdin
- name: Enable docker experimental features for docker manifests
run: |
echo '{"experimental": true}' | sudo tee -a /etc/docker/daemon.json
sudo systemctl restart docker
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_CLI_EXPERIMENTAL: enabled

32
.github/workflows/release_test.yml vendored Normal file
View File

@@ -0,0 +1,32 @@
name: release
on:
push:
branches: ["master"]
pull_request:
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unshallow
run: git fetch --prune --unshallow
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.15.x
- name: Test
run: go test -cover ./...
- name: Vet
run: go vet ./...
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
with:
version: latest
args: release --rm-dist --skip-publish

View File

@@ -28,6 +28,10 @@ builds:
- amd64
- arm
- arm64
- 386
- riscv64
- ppc64le
- s390x
# GOARM to build for when GOARCH is arm.
# For more info refer to: https://golang.org/doc/install/source#environment
@@ -62,11 +66,128 @@ changelog:
- '^test:'
dockers:
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: amd64
use_buildx: true
build_flag_templates:
- "--platform=linux/amd64"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}"
- "hikhvar/mqtt2prometheus:latest"
- "docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:{{ .Tag }}"
- "docker.pkg.github.com/hikhvar/mqtt2prometheus/mqtt2prometheus:latest"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}"
- "ghcr.io/hikhvar/mqtt2prometheus:latest"
- "hikhvar/mqtt2prometheus:{{ .Tag }}-amd64"
- "hikhvar/mqtt2prometheus:latest-amd64"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-amd64"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-amd64"
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: arm64
use_buildx: true
build_flag_templates:
- "--platform=linux/arm64"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm64"
- "hikhvar/mqtt2prometheus:latest-arm64"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm64"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm64"
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: arm
goarm: 6
use_buildx: true
build_flag_templates:
- "--platform=linux/arm/v6"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm6"
- "hikhvar/mqtt2prometheus:latest-arm6"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm6"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm6"
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: arm
goarm: 6
use_buildx: true
build_flag_templates:
- "--platform=linux/arm/v6"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm6"
- "hikhvar/mqtt2prometheus:latest-arm6"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm6"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm6"
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: arm
goarm: 7
use_buildx: true
build_flag_templates:
- "--platform=linux/arm/v7"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm7"
- "hikhvar/mqtt2prometheus:latest-arm7"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm7"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm7"
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: 386
use_buildx: true
build_flag_templates:
- "--platform=linux/386"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-386"
- "hikhvar/mqtt2prometheus:latest-386"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-386"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-386"
- dockerfile: release/Dockerfile.scratch
goos: linux
goarch: riscv64
use_buildx: true
build_flag_templates:
- "--platform=linux/riscv64"
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-riscv64"
- "hikhvar/mqtt2prometheus:latest-riscv64"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-riscv64"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-riscv64"
docker_manifests:
# Docker Registry
- name_template: hikhvar/mqtt2prometheus:{{ .Tag }}
image_templates:
- "hikhvar/mqtt2prometheus:{{ .Tag }}-amd64"
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm64"
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm6"
- "hikhvar/mqtt2prometheus:{{ .Tag }}-arm7"
- "hikhvar/mqtt2prometheus:{{ .Tag }}-riscv64"
- "hikhvar/mqtt2prometheus:{{ .Tag }}-386"
- name_template: hikhvar/mqtt2prometheus:latest
image_templates:
- "hikhvar/mqtt2prometheus:latest-amd64"
- "hikhvar/mqtt2prometheus:latest-arm64"
- "hikhvar/mqtt2prometheus:latest-arm6"
- "hikhvar/mqtt2prometheus:latest-arm7"
- "hikhvar/mqtt2prometheus:latest-riscv64"
- "hikhvar/mqtt2prometheus:latest-386"
# Github Registry
- name_template: ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}
image_templates:
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-amd64"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm64"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm6"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-arm7"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-riscv64"
- "ghcr.io/hikhvar/mqtt2prometheus:{{ .Tag }}-386"
- name_template: ghcr.io/hikhvar/mqtt2prometheus:latest
image_templates:
- "ghcr.io/hikhvar/mqtt2prometheus:latest-amd64"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm64"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm6"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-arm7"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-riscv64"
- "ghcr.io/hikhvar/mqtt2prometheus:latest-386"