-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
40 lines (31 loc) · 1.5 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
REGISTRY ?= ghcr.io
USERNAME ?= siderolabs
TAG ?= latest
REGISTRY_AND_USERNAME := $(REGISTRY)/$(USERNAME)
NAME := build-container
BUILD := docker buildx build
PLATFORM ?= linux/amd64
PROGRESS ?= auto
PUSH ?= false
CI_ARGS ?=
COMMON_ARGS := --file=Dockerfile
COMMON_ARGS += --progress=$(PROGRESS)
COMMON_ARGS += --platform=$(PLATFORM)
COMMON_ARGS += --provenance=false
all: build-container
KRES_IMAGE ?= ghcr.io/siderolabs/kres:latest
all: $(TARGETS) ## Builds all targets defined.
target-%: ## Builds the specified target defined in the Pkgfile. The build result will only remain in the build cache.
@$(BUILD) --target=$* $(COMMON_ARGS) $(TARGET_ARGS) $(CI_ARGS) .
local-%: ## Builds the specified target defined in the Pkgfile using the local output type. The build result will be output to the specified local destination.
@$(MAKE) target-$* TARGET_ARGS="--output=type=local,dest=$(DEST) $(TARGET_ARGS)"
docker-%: ## Builds the specified target defined in the Pkgfile using the docker output type. The build result will be loaded into Docker.
@$(MAKE) target-$* TARGET_ARGS="--tag $(REGISTRY_AND_USERNAME)/$(NAME):$(TAG) $(TARGET_ARGS)"
.PHONY: build-container
build-container:
@$(MAKE) docker-build-container-drone TARGET_ARGS="--push=$(PUSH)"
@$(MAKE) docker-build-container-ghaction TARGET_ARGS="--push=$(PUSH)" TAG="actions-runner-ubuntu-22.04"
.PHONY: rekres
rekres:
@docker pull $(KRES_IMAGE)
@docker run --rm --net=host --user $(shell id -u):$(shell id -g) -v $(PWD):/src -w /src -e GITHUB_TOKEN $(KRES_IMAGE)