-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 973 Bytes
/
Copy pathMakefile
File metadata and controls
37 lines (30 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
BINARY_NAME=kidsnoter
DOCKER_IMAGE_NAME=ghcr.io/karolistamutis/kidsnoter
VERSION=$(shell git describe --tags --always --dirty)
PLATFORMS=linux/amd64,linux/arm64
GO=go
.PHONY: all build clean run docker-build docker-push
all: build
build:
$(GO) build -ldflags "-X github.com/karolistamutis/kidsnoter/cmd.Version=$(VERSION)" -o $(BINARY_NAME) .
clean:
$(GO) clean
rm -f $(BINARY_NAME)
run:
$(GO) run .
docker-build:
docker buildx create --use --name multi-arch-builder || true
docker buildx build --platform $(PLATFORMS) \
--build-arg VERSION=$(VERSION) \
-t $(DOCKER_IMAGE_NAME):$(VERSION) \
-t $(DOCKER_IMAGE_NAME):latest \
.
docker-push:
@echo "$(GITHUB_PAT)" | docker login ghcr.io -u karolistamutis --password-stdin
docker buildx create --use --name multi-arch-builder || true
docker buildx build --platform $(PLATFORMS) \
--build-arg VERSION=$(VERSION) \
-t $(DOCKER_IMAGE_NAME):$(VERSION) \
-t $(DOCKER_IMAGE_NAME):latest \
--push \
.