Skip to content
Permalink
Browse files

Add platform for multi-arch builds

PLATFORM is now populated in the Makefile so that it can be
used in an on-device Docker build.

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
  • Loading branch information...
alexellis committed May 9, 2019
1 parent a4aa8d0 commit 1471d68aa767fa3faa0da4e7745a5440144e4bbd
Showing with 22 additions and 2 deletions.
  1. +3 −2 Makefile
  2. +19 −0 hack/platform-tag.sh
@@ -1,6 +1,7 @@
Version := $(shell git describe --tags --dirty)
GitCommit := $(shell git rev-parse HEAD)
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
PLATFORM := $(shell ./hack/platform-tag.sh)

.PHONY: all
all: docker
@@ -14,12 +15,12 @@ dist:

.PHONY: docker
docker:
docker build --build-arg Version=$(Version) --build-arg GIT_COMMIT=$(GitCommit) -t alexellis2/inlets:$(Version) .
docker build --build-arg Version=$(Version) --build-arg GIT_COMMIT=$(GitCommit) -t alexellis2/inlets:$(Version)$(PLATFORM) .

.PHONY: docker-login
docker-login:
echo -n "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin

.PHONY: push
push:
docker push alexellis2/inlets:$(Version)
docker push alexellis2/inlets:$(Version)$(PLATFORM)
@@ -0,0 +1,19 @@
#!/bin/sh

getPackage() {
suffix=""
arch=$(uname -m)
case $arch in
"aarch64")
suffix="-arm64"
;;
esac
case $arch in
"armv6l" | "armv7l")
suffix="-armhf"
;;
esac
}

getPackage
echo -n $suffix

0 comments on commit 1471d68

Please sign in to comment.
You can’t perform that action at this time.