Skip to content

Commit

Permalink
Add make targets to build devel image of syncer (#135)
Browse files Browse the repository at this point in the history
* Add make targets to build devel image of syncer

This image can be used with the metal-toolbox/sandbox

* review comments: update target to push-image-devel

Align better with metal-toolbox/flasher
  • Loading branch information
diogomatsubara authored Nov 10, 2023
1 parent 2f3501f commit 3758538
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 ./...
Expand All @@ -22,6 +33,18 @@ 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 docker image and tag as ghcr.io/metal-toolbox/firmware-syncer:latest
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)

## tag and push devel docker image to local registry
push-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
Expand Down

0 comments on commit 3758538

Please sign in to comment.