Skip to content

Commit

Permalink
Merge pull request #17 from netsampler/feature/arm
Browse files Browse the repository at this point in the history
feature: add arm builds
  • Loading branch information
lspgn authored Jun 12, 2021
2 parents e52a053 + 5830590 commit 6465eeb
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
GOOS=linux make build
GOOS=darwin make build
GOOS=windows EXTENSION=.exe make build
ARCH=arm64 GOARCH=arm64 GOOS=linux make build
- name: Install fpm
run: |
Expand All @@ -41,7 +42,9 @@ jobs:
sudo gem install fpm
- name: Package
run: make package-deb package-rpm
run: |
make package-deb package-rpm
ARCH=arm64 make package-deb package-rpm
- name: Upload Artifact
uses: actions/upload-artifact@v2
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/docker-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ jobs:
- name: Build
run: |
export VERSION=$(git describe --tags --abbrev=0 HEAD)
make docker
make push-docker-release
DOCKER_SUFFIX=-amd64 make docker push-docker
DOCKER_SUFFIX=-arm64 DOCKER_CMD='buildx build --push --platform linux/arm64/v8' make docker
make docker-manifest-release
5 changes: 3 additions & 2 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ jobs:

- name: Build
run: |
make docker
make push-docker
DOCKER_SUFFIX=-amd64 make docker push-docker
DOCKER_SUFFIX=-arm64 DOCKER_CMD='buildx build --push --platform linux/arm64/v8' make docker
make docker-manifest
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.14
go-version: ^1.16

- name: Check out code into the Go module directory
uses: actions/checkout@v1
Expand All @@ -34,6 +34,8 @@ jobs:
GOOS=darwin make build
GOOS=windows EXTENSION=.exe make build
make package-deb package-rpm
ARCH=arm64 GOARCH=arm64 GOOS=linux make build
ARCH=arm64 make package-deb package-rpm
- name: Create Release
id: create_release
Expand Down
41 changes: 27 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
EXTENSION ?=
DIST_DIR ?= dist/
GOOS ?= linux
ARCH ?= $(shell uname -m)
EXTENSION ?=
DIST_DIR ?= dist/
GOOS ?= linux
ARCH ?= $(shell uname -m)
BUILDINFOSDET ?=

DOCKER_REPO := netsampler/
Expand All @@ -11,14 +11,15 @@ ABBREV ?= $(shell git rev-parse --short HEAD)
COMMIT ?= $(shell git rev-parse HEAD)
TAG ?= $(shell git describe --tags --abbrev=0 HEAD)
VERSION_PKG ?= $(shell echo $(VERSION) | sed 's/^v//g')
ARCH := x86_64
LICENSE := BSD-3-Clause
URL := https://github.com/netsampler/goflow2
DESCRIPTION := GoFlow2: Open-Source and Scalable Network Sample Collector
DATE := $(shell date +%FT%T%z)
BUILDINFOS ?= ($(DATE)$(BUILDINFOSDET))
LDFLAGS ?= '-X main.version=$(VERSION) -X main.buildinfos=$(BUILDINFOS)'
MAINTAINER := [email protected]
DOCKER_CMD ?= build
DOCKER_SUFFIX ?=

OUTPUT := $(DIST_DIR)goflow2-$(VERSION_PKG)-$(GOOS)-$(ARCH)$(EXTENSION)

Expand Down Expand Up @@ -50,7 +51,7 @@ build: prepare

.PHONY: docker
docker:
docker build \
docker $(DOCKER_CMD) \
--build-arg LDFLAGS=$(LDFLAGS) \
--build-arg CREATED="$(DATE)" \
--build-arg MAINTAINER="$(MAINTAINER)" \
Expand All @@ -60,18 +61,30 @@ docker:
--build-arg LICENSE="$(LICENSE)" \
--build-arg VERSION="$(VERSION)" \
--build-arg REV="$(COMMIT)" \
-t $(DOCKER_REPO)$(NAME):$(ABBREV) .
-t $(DOCKER_REPO)$(NAME):$(ABBREV)$(DOCKER_SUFFIX) .

.PHONY: push-docker
push-docker:
docker push $(DOCKER_REPO)$(NAME):$(ABBREV)
docker tag $(DOCKER_REPO)$(NAME):$(ABBREV) $(DOCKER_REPO)$(NAME):latest
docker push $(DOCKER_REPO)$(NAME):latest
docker push $(DOCKER_REPO)$(NAME):$(ABBREV)$(DOCKER_SUFFIX)

.PHONY: push-docker-release
push-docker-release:
docker tag $(DOCKER_REPO)$(NAME):$(ABBREV) $(DOCKER_REPO)$(NAME):$(VERSION)
docker push $(DOCKER_REPO)$(NAME):$(VERSION)
.PHONY: docker-manifest
docker-manifest:
docker manifest create $(DOCKER_REPO)$(NAME):$(ABBREV) \
--amend $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \
--amend $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64
docker manifest push $(DOCKER_REPO)$(NAME):$(ABBREV)

docker manifest create $(DOCKER_REPO)$(NAME):latest \
--amend $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \
--amend $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64
docker manifest push $(DOCKER_REPO)$(NAME):latest

.PHONY: docker-manifest-release
docker-manifest-release:
docker manifest create $(DOCKER_REPO)$(NAME):$(VERSION) \
--amend $(DOCKER_REPO)$(NAME):$(ABBREV)-amd64 \
--amend $(DOCKER_REPO)$(NAME):$(ABBREV)-arm64
docker manifest push $(DOCKER_REPO)$(NAME):$(VERSION)

.PHONY: package-deb
package-deb: prepare
Expand Down

0 comments on commit 6465eeb

Please sign in to comment.