-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (32 loc) · 806 Bytes
/
Makefile
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
38
39
40
LATEST_TAG := $(shell git describe --tags)
TAG ?= latest
SHELL = /bin/bash
.PHONY: clean test
greenlight: go.* *.go
go build \
-ldflags "-s -w -X main.Version=$(LATEST_TAG)" \
-o $@ \
cmd/greenlight/main.go
clean:
rm -rf greenlight dist/ vendor/ Dockerfile
test:
go test -v ./...
install:
go install \
-ldflags "-s -w -X main.Version=$(LATEST_TAG)" \
./cmd/greenlight
dist:
goreleaser build --snapshot --rm-dist
Dockerfile:
cat Dockerfile.build > Dockerfile
echo "FROM $(BASE_IMAGE)" >> Dockerfile
cat Dockerfile.target >> Dockerfile
docker-build-and-push: Dockerfile
go mod vendor
docker buildx build \
--build-arg version=${LATEST_TAG} \
--platform=linux/amd64,linux/arm64 \
-t ghcr.io/fujiwara/greenlight:${LATEST_TAG}${IMAGE_SUFFIX} \
-f Dockerfile \
--push \
.