This repository has been archived by the owner on Feb 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
55 lines (48 loc) · 1.51 KB
/
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
DOCKER_IMAGE = nrocco/bookmarks
DOCKER_IMAGE_VERSION = latest
BUILD_VERSION ?= $(shell git describe --tags --always --dirty)
BUILD_COMMIT ?= $(shell git describe --always --dirty)
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
.PHONY: help
help:
@echo 'make build-all dist/bookmarks-amd64-darwin dist/bookmarks-amd64-linux clear container push'
.PHONY: build-all
build-all: \
dist/bookmarks-amd64-darwin \
dist/bookmarks-amd64-linux
.PHONY: dist/bookmarks-amd64-darwin
dist/bookmarks-amd64-darwin:
mkdir -p dist/bookmarks-amd64-darwin
docker image build --pull \
--build-arg "BUILD_VERSION=$(BUILD_VERSION)" \
--build-arg "BUILD_COMMIT=$(BUILD_COMMIT)" \
--build-arg "BUILD_DATE=$(BUILD_DATE)" \
--target bin \
--platform darwin/amd64 \
--output dist/bookmarks-amd64-darwin \
.
.PHONY: dist/bookmarks-amd64-linux
dist/bookmarks-amd64-linux:
mkdir -p dist/bookmarks-amd64-linux
docker image build --pull \
--build-arg "BUILD_VERSION=$(BUILD_VERSION)" \
--build-arg "BUILD_COMMIT=$(BUILD_COMMIT)" \
--build-arg "BUILD_DATE=$(BUILD_DATE)" \
--target bin \
--platform linux/amd64 \
--output dist/bookmarks-amd64-linux \
.
.PHONY: clear
clear:
rm -rf dist
.PHONY: container
container:
docker image build --pull \
--build-arg "BUILD_VERSION=$(BUILD_VERSION)" \
--build-arg "BUILD_COMMIT=$(BUILD_COMMIT)" \
--build-arg "BUILD_DATE=$(BUILD_DATE)" \
--tag "$(DOCKER_IMAGE):$(DOCKER_IMAGE_VERSION)" \
.
.PHONY: push
push: container
docker image push "$(DOCKER_IMAGE):$(DOCKER_IMAGE_VERSION)"