-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
23 lines (20 loc) · 851 Bytes
/
Makefile
File metadata and controls
23 lines (20 loc) · 851 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
VERSION ?= $(shell runner/gnmic version | cut -d ' ' -f 3 | cut -d ':' -f 1)
BUILD_DIR = build
CGO_ENABLED ?= 0
DOCKERHUB_REPO = ghcr.io/orb-community
GOARCH ?= $(shell dpkg-architecture -q DEB_BUILD_ARCH)
COMMIT_HASH = $(shell git rev-parse --short HEAD)
REF_TAG ?= latest
getgnmic:
wget -O /tmp/gnmic.tar.gz https://github.com/openconfig/gnmic/releases/download/v0.30.0/gnmic_0.30.0_Linux_x86_64.tar.gz
tar -xvzf /tmp/gnmic.tar.gz -C /tmp/
mv /tmp/gnmic runner/gnmic
rm -rf /tmp/gnmic*
build:
CGO_ENABLED=$(CGO_ENABLED) GOOS=linux GOARCH=$(GOARCH) GOARM=$(GOARM) go build -o ${BUILD_DIR}/orb-gnmic cmd/main.go
container:
docker build --no-cache \
--tag=$(DOCKERHUB_REPO)/orb-gnmic:$(REF_TAG) \
--tag=$(DOCKERHUB_REPO)/orb-gnmic:$(VERSION) \
--tag=$(DOCKERHUB_REPO)/orb-gnmic:$(VERSION)-$(COMMIT_HASH) \
-f docker/Dockerfile .