Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support release of arm64 artifacts #42

Merged
merged 5 commits into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ on:
jobs:
goreleaser:
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"

steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Go
uses: actions/setup-go@v2
with:
Expand Down
39 changes: 26 additions & 13 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ builds:
- darwin
goarch:
- amd64
- arm64
binary: feederd
checksum:
name_template: "checksums.txt"
Expand Down Expand Up @@ -40,53 +41,65 @@ archives:

dockers:
# push always either release or prerelease with a docker tag with the semver only
# amd64
- skip_push: false
dockerfile: Dockerfile
use: buildx
# image templates
image_templates:
- "ghcr.io/tdex-network/feederd:{{ .Tag }}"
- "ghcr.io/tdex-network/feederd:{{ .Tag }}-amd64"
# GOOS of the built binaries/packages that should be used.
goos: linux
# GOARCH of the built binaries/packages that should be used.
goarch: amd64
# Template of the docker build flags.
build_flag_templates:
- "--platform=linux/amd64"
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=VERSION={{.Version}}"
- "--build-arg=COMMIT={{.Commit}}"
- "--build-arg=DATE={{.Date}}"

extra_files:
- go.mod
- go.sum
- internal
- cmd
# push only release with both a docker tag latest and one with the semver
- skip_push: auto

# arm64
- skip_push: false
dockerfile: Dockerfile
use: buildx
# image templates
image_templates:
- "ghcr.io/tdex-network/feederd:latest"
- "ghcr.io/tdex-network/feederd:{{ .Tag }}-arm64v8"
# GOOS of the built binaries/packages that should be used.
goos: linux
# GOARCH of the built binaries/packages that should be used.
goarch: amd64
goarch: arm64
# Template of the docker build flags.
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--build-arg=VERSION={{.Version}}"
- "--build-arg=COMMIT={{.Commit}}"
- "--build-arg=DATE={{.Date}}"
extra_files:
- go.mod
- go.sum
- internal
- cmd
- cmd

docker_manifests:
- name_template: ghcr.io/tdex-network/feederd:{{ .Tag }}
image_templates:
- ghcr.io/tdex-network/feederd:{{ .Tag }}-amd64
- ghcr.io/tdex-network/feederd:{{ .Tag }}-arm64v8
skip_push: false

- name_template: ghcr.io/tdex-network/feederd:latest
image_templates:
- ghcr.io/tdex-network/feederd:{{ .Tag }}-amd64
- ghcr.io/tdex-network/feederd:{{ .Tag }}-arm64v8
skip_push: auto
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
FROM golang:1.15.5-buster AS builder

ARG TARGETOS
ARG TARGETARCH

WORKDIR /tdex-feeder

COPY go.mod .
Expand All @@ -8,7 +11,7 @@ RUN go mod download

COPY . .

RUN GOOS=linux GOARCH=amd64 go build -o feederd-linux cmd/feederd/main.go
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -o feederd-linux cmd/feederd/main.go

WORKDIR /build

Expand Down