forked from ml-hispano/ml-hispano.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (58 loc) · 2.27 KB
/
Makefile
File metadata and controls
63 lines (58 loc) · 2.27 KB
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
56
57
58
59
60
61
62
63
SNAME ?= mkdocs-diy
NAME ?= elswork/$(SNAME)
VER ?= `cat VERSION`
BASE ?= alpine
BASENAME ?= python:$(BASE)
RUTA ?= $(CURDIR)
SITE ?=
TO ?= /src
ARCH2 ?= armv7l
ARCH3 ?= aarch64
GOARCH := $(shell uname -m)
ifeq ($(GOARCH),x86_64)
GOARCH := amd64
endif
# HELP
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## This help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.DEFAULT_GOAL := help
# DOCKER TASKS
# Build the container
debug: ## Build the container
docker build -t $(NAME):$(GOARCH) \
--build-arg BASEIMAGE=$(BASENAME) \
--build-arg VERSION=$(SNAME)_$(GOARCH)_$(VER) .
build: ## Build the container
docker build --no-cache -t $(NAME):$(GOARCH) --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BASEIMAGE=$(BASENAME) \
--build-arg VERSION=$(SNAME)_$(GOARCH)_$(VER) . > ../builds/$(SNAME)_$(GOARCH)_$(VER)_`date +"%Y%m%d_%H%M%S"`.txt
tag: ## Tag the container
docker tag $(NAME):$(GOARCH) $(NAME):$(GOARCH)_$(VER)
push: ## Push the container
docker push $(NAME):$(GOARCH)_$(VER)
docker push $(NAME):$(GOARCH)
deploy: build tag push
manifest: ## Create an push manifest
docker manifest create $(NAME):$(VER) \
$(NAME):$(GOARCH)_$(VER) \
$(NAME):$(ARCH2)_$(VER) \
$(NAME):$(ARCH3)_$(VER)
docker manifest push --purge $(NAME):$(VER)
docker manifest create $(NAME):latest $(NAME):$(GOARCH) \
$(NAME):$(ARCH2) \
$(NAME):$(ARCH3)
docker manifest push --purge $(NAME):latest
serve: ## Preview and live modify with auto-reloading $(RUTA)/$(SITE)
docker run -it --rm -v $(RUTA)/$(SITE):/mkdocs -p 7777:7777 $(NAME):$(GOARCH) mkdocs serve -a 0.0.0.0:7777
mkbuild: ## Generate website static files
docker run -it --rm -v $(RUTA)/$(SITE):/mkdocs -p 7777:7777 $(NAME):$(GOARCH) mkdocs build
mkhelp: ## MkDocs commands help
docker run -it --rm -v $(RUTA)/$(SITE):/mkdocs -p 7777:7777 $(NAME):$(GOARCH) mkdocs -h
helpserve: ## MkDocs serve command help
docker run -it --rm -v $(RUTA)/$(SITE):/mkdocs -p 7777:7777 $(NAME):$(GOARCH) mkdocs serve -h
version: ## Display MkDocs version
docker run -it --rm -v $(RUTA)/$(SITE):/mkdocs -p 7777:7777 $(NAME):$(GOARCH) mkdocs -V