Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2ae37c2

Browse files
weltekialexellis
authored andcommittedJun 17, 2024·
Add publish make target
Signed-off-by: Han Verstraete (OpenFaaS Ltd) <han@openfaas.com>
1 parent 4e8e957 commit 2ae37c2

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 

‎Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Version := $(shell git describe --tags --dirty)
33
GitCommit := $(shell git rev-parse HEAD)
44
LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)"
55

6+
7+
SERVER?=ghcr.io
8+
OWNER?=openfaas
9+
IMG_NAME?=classic-watchdog
10+
TAG?=$(Version)
11+
612
.PHONY: all
713
all: gofmt test dist hashgen
814

@@ -26,3 +32,15 @@ dist:
2632
GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/fwatchdog-arm64
2733
GOOS=windows CGO_ENABLED=0 go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/fwatchdog.exe
2834
GOOS=darwin CGO_ENABLED=0 go build -mod=vendor -a -ldflags $(LDFLAGS) -installsuffix cgo -o bin/fwatchdog-darwin
35+
36+
# Example:
37+
# SERVER=docker.io OWNER=alexellis2 TAG=ready make publish
38+
.PHONY: publish
39+
publish:
40+
@echo $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) && \
41+
docker buildx create --use --name=multiarch --node=multiarch && \
42+
docker buildx build \
43+
--platform linux/amd64,linux/arm/v7,linux/arm64 \
44+
--push=true \
45+
--tag $(SERVER)/$(OWNER)/$(IMG_NAME):$(TAG) \
46+
.

0 commit comments

Comments
 (0)
Please sign in to comment.