-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
38 lines (29 loc) · 889 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
PROJECT = md2html
IMAGE = cnam/$(PROJECT)
TAG = 0.2.4
OBJDIR = bin
OBJS = $(OBJDIR)/amd64(darwin_$(PROJECT) linux_$(PROJECT))
all: build
help:
@echo " build - create binary and new docker image \n"\
"release - push new docker image"
$(OBJS): $(find $(CURDIR) -name "*.go" -type f)
@docker run --rm \
-v $(CURDIR):/src \
-e GOOS=$(shell echo $%|sed -e "s/_$(PROJECT)//") \
-e GOARCH=$(shell echo $(@D)|sed -e "s#$(OBJDIR)##") \
leanlabs/golang-builder
-@mkdir -p $(CURDIR)/$@
@mv $(PROJECT) $(CURDIR)/$@$%
$(PROJECT): $(find $(CURDIR) -name "*.go" -type f)
@docker run --rm \
-v $(CURDIR):/src \
leanlabs/golang-builder
docker_build: $(PROJECT)
@docker build -t $(IMAGE) .
@docker tag $(IMAGE):latest $(IMAGE):$(TAG)
build: $(OBJS) docker_build
release:
@docker push $(IMAGE):latest
@docker push $(IMAGE):$(TAG)
.PHONY: help test build release