-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (52 loc) · 1.64 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
56
57
58
59
60
61
62
63
64
65
66
67
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
COMMA := ,
PROJECT_NAME := 'model-deploy'
PYTHON_IMAGE_VERSION := $(shell cat .python-version)
CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed -e 's/_/-/g; s/\//-/g')
CURRENT_VERSION := $(shell git rev-parse --short HEAD)
install: poetry install
.PHONY: install
venv: poetry shell
.PHONY: venv
lint-fix: ## Fix lint
isort .
black .
.PHONY: lint-fix
ci: lint typecheck test ## Run all checks (lint, typecheck, test)
.PHONY: ci
clean: ## Clean cache files
find . -name '__pycache__' -type d | xargs rm -rvf
find . -name '.mypy_cache' -type d | xargs rm -rvf
find . -name '.pytest_cache' -type d | xargs rm -rvf
.PHONY: clean
docker-build: Dockerfile ## Build docker image
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker build \
-f $^ \
--build-arg PYTHON_IMAGE_VERSION=$(PYTHON_IMAGE_VERSION) \
--tag $(PROJECT_NAME):$(CURRENT_BRANCH) \
--tag $(PROJECT_NAME):$(CURRENT_VERSION) .
.PHONY: docker-build
py-dind-build: docker/pydind.Dockerfile ## Build docker image
docker build \
-f $^ \
--tag py311dind:$(CURRENT_BRANCH) \
--tag py311dind:latest .
.PHONY: py-dind-build
py-dind-tag:
docker image tag \
py311dind:latest \
localhost:5000/py311dind:latest
.PHONY: py-dind-tag
py-dind-push:
docker image push \
localhost:5000/py311dind:latest
.PHONY: py-dind-push
.DEFAULT_GOAL := help
help: Makefile
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help