-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
38 lines (34 loc) · 1.08 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
ROOT_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION ?= $(shell git describe --candidates=50 --abbrev=0 --tags 2>/dev/null || echo "v0.1.0" )
VM_NAME ?= tangent-0
REPO ?= ghcr.io/frelon/tangent
ELEMENTAL ?= ghcr.io/rancher/elemental-toolkit/elemental-cli:v2.0.0
DOCKER ?= docker
ARCH ?= x86_64
PLATFORM ?= linux/$(ARCH)
IMAGE_SIZE?=20G
QCOW2 ?=$(ROOT_DIR)/build/tangent-$(ARCH).qcow2
.PHONY: build
build:
@echo Building Tangent-${ARCH} disk
mkdir -p build
docker build --load --build-arg ELEMENTAL_IMAGE=${ELEMENTAL} --build-arg REPO=${REPO} --build-arg VERSION=${VERSION} -t ${REPO}:${VERSION} .
$(DOCKER) run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(ROOT_DIR)/build:/build \
$(ELEMENTAL) build-disk \
--debug \
--local \
--expandable \
-n tangent-$(ARCH) \
-o /build/ \
--platform $(PLATFORM) \
--system $(REPO):$(VERSION)
qemu-img convert -O qcow2 build/tangent-$(ARCH).raw build/tangent-$(ARCH).qcow2
.PHONY:
down:
@./run_vm.sh stop
@./run_vm.sh clean
.PHONY: up
up:
@./run_vm.sh start $(QCOW2)