Skip to content

Commit

Permalink
Support arm64 builds
Browse files Browse the repository at this point in the history
Update the goreleaesr config with:
* arm64 binary builds
* mutli-arch docker image builds

Also, add the newly required dependencies for multi-arch builds to the
Github Actions workflows.
  • Loading branch information
jalaziz committed Sep 6, 2022
1 parent 1101854 commit b6da5ff
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ jobs:

- uses: arduino/setup-task@v1

- uses: docker/setup-qemu-action@v2

- uses: docker/setup-buildx-action@v2

- name: Install GCC for arm64
run: |
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ jobs:

- uses: arduino/setup-task@v1

- uses: docker/setup-qemu-action@v2

- uses: docker/setup-buildx-action@v2

- name: Install GCC for arm64
run: |
sudo apt-get install gcc-aarch64-linux-gnu
- name: Install Syft
run: |
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
Expand Down
63 changes: 55 additions & 8 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,29 @@ snapshot:

builds:
- main: ./cmd/flipt/.
env:
- CGO_ENABLED=1
ldflags:
- -s -w -X main.version={{ .Version }} -X main.commit={{ .Commit }} -X main.date={{ .Date }} -X main.analyticsKey={{ .Env.ANALYTICS_KEY }}
- -linkmode external -extldflags -static
goos:
- linux
goarch:
- amd64
- arm64
flags:
- -tags=assets,netgo
- -trimpath
overrides:
- goos: linux
goarch: amd64
goamd64: v1
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- goos: linux
goarch: arm64
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc

sboms:
- artifacts: archive
Expand All @@ -39,20 +50,56 @@ changelog:
dockers:
- dockerfile: ./build/Dockerfile
use: buildx
goarch: amd64
image_templates:
- "flipt/flipt:latest"
- "flipt/flipt:{{ .Tag }}"
- "markphelps/flipt:latest" # TODO: deprecate
- "markphelps/flipt:{{ .Tag }}" # TODO: deprecate
- "ghcr.io/flipt-io/flipt:latest"
- "ghcr.io/flipt-io/flipt:{{ .Tag }}"
- "flipt/flipt:{{ .Tag }}-amd64"
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- config/migrations/
- config/default.yml
- dockerfile: ./build/Dockerfile
use: buildx
goarch: arm64
image_templates:
- "flipt/flipt:{{ .Tag }}-arm64"
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
extra_files:
- config/migrations/
- config/default.yml

docker_manifests:
- name_template: "flipt/flipt:latest"
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "flipt/flipt:{{ .Tag }}"
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "markphelps/flipt:latest" # TODO: deprecate
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "markphelps/flipt:{{ .Tag }}" # TODO: deprecate
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "ghcr.io/flipt-io/flipt:latest"
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"
- name_template: "ghcr.io/flipt-io/flipt:{{ .Tag }}"
image_templates:
- "flipt/flipt:{{ .Tag }}-amd64"
- "flipt/flipt:{{ .Tag }}-arm64"

announce:
discord:
Expand Down

0 comments on commit b6da5ff

Please sign in to comment.