-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (25 loc) · 1 KB
/
Makefile
File metadata and controls
29 lines (25 loc) · 1 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
IMAGE_NAME ?= quay.io/surajd/nanochat
# find the latest commit hash for the nanochat repo from the master branch
NANOCHAT_VERSION ?= $(shell gh api repos/karpathy/nanochat/commits/master --jq '.sha' | cut -c1-7)
IMAGE_TAG ?= $(NANOCHAT_VERSION)-$(shell git rev-parse --short HEAD)-$(shell date +%Y%m%d%H%M%S)
PLATFORM ?= linux/amd64
.PHONY: help build push login
help: ## Show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-10s\033[0m %s\n", $$1, $$2}'
build: ## Build image locally (docker buildx --load)
docker buildx build \
--platform $(PLATFORM) \
--build-arg NANOCHAT_VERSION=$(NANOCHAT_VERSION) \
--tag $(IMAGE_NAME):$(IMAGE_TAG) \
--tag $(IMAGE_NAME):latest \
--load \
.
push: ## Build and push image to registry (docker buildx --push)
docker buildx build \
--platform $(PLATFORM) \
--build-arg NANOCHAT_VERSION=$(NANOCHAT_VERSION) \
--tag $(IMAGE_NAME):$(IMAGE_TAG) \
--tag $(IMAGE_NAME):latest \
--push \
.