From 5c55a14c7fef04c8cc13e1a084e5ca80d34a8324 Mon Sep 17 00:00:00 2001 From: Diogo Mendes Matsubara Date: Thu, 9 Nov 2023 14:10:55 +0100 Subject: [PATCH] Add make targets to build devel image of syncer This image can be used with the metal-toolbox/sandbox --- Makefile | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Makefile b/Makefile index deb7dd11..c6d19866 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,16 @@ +export DOCKER_BUILDKIT=1 +GIT_COMMIT := $(shell git rev-parse --short HEAD) +GIT_BRANCH := $(shell git symbolic-ref -q --short HEAD) +GIT_SUMMARY := $(shell git describe --tags --dirty --always) +VERSION := $(shell git describe --tags 2> /dev/null) +BUILD_DATE := $(shell date +%s) +GIT_COMMIT_FULL := $(shell git rev-parse HEAD) +DOCKER_IMAGE := "ghcr.io/metal-toolbox/firmware-syncer" +REPO := "https://github.com/metal-toolbox/firmware-syncer.git" + .DEFAULT_GOAL := help + ## Go test test: CGO_ENABLED=0 go test -covermode=atomic ./... @@ -22,6 +33,17 @@ build-linux: go-mod CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o firmware-syncer -mod vendor sha256sum firmware-syncer > firmware-syncer_checksum.txt +build-image: build-linux + docker build --rm=true -f Dockerfile -t ${DOCKER_IMAGE}:latest . \ + --label org.label-schema.schema-version=1.0 \ + --label org.label-schema.vcs-ref=$(GIT_COMMIT_FULL) \ + --label org.label-schema.vcs-url=$(REPO) + +## Build devel docker image +build-image-devel: build-image + docker tag ${DOCKER_IMAGE}:latest localhost:5001/firmware-syncer:latest + docker push localhost:5001/firmware-syncer:latest + kind load docker-image localhost:5001/firmware-syncer:latest # https://gist.github.com/prwhite/8168133 # COLORS