-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile.docker
More file actions
52 lines (40 loc) · 1.88 KB
/
Makefile.docker
File metadata and controls
52 lines (40 loc) · 1.88 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
# This Makefile is run inside the docker machine.
include root/build/versions.env
TYPE ?= raw.xz
ARCH ?= $(shell uname -m)
/build/distro.${TYPE}:
GO_ARCH := $(ARCH:x86_64=amd64)
GO_ARCH := $(GO_ARCH:aarch64=arm64)
INPUTS += root/build/nerdctl-$(NERDCTL_VERSION).tgz
rancher-desktop-distro.%.raw: config.kiwi config.sh ${INPUTS}
kiwi --debug --profile=lima system build \
--description /description --target-dir /build
rancher-desktop-distro.%.tar.xz: config.kiwi config.sh ${INPUTS}
kiwi --debug --profile=wsl system build \
--description /description --target-dir /build
# Post-kiwi cleanup, then produce the requested output format.
#
# clean-rootfs.sh loop-mounts the raw disk, removes grub2 build tools
# and other build-time artifacts, then fstrim's the filesystem so freed
# blocks become holes. It runs here rather than in pre_disk_sync.sh
# because kiwi re-invokes grub2-mkconfig on the mounted disk after that
# hook.
#
# raw.xz — for macOS/VZ: qemu and VZ both consume raw directly.
# qcow2.xz — for Linux/qemu: internally zstd-compressed, then
# xz-compressed for storage/transfer.
/build/distro.raw.xz: /build/rancher-desktop-distro.$(ARCH)-0.100.0.raw
./clean-rootfs.sh $<
xz -9 --extreme --stdout $< > $@
/build/distro.qcow2: /build/rancher-desktop-distro.$(ARCH)-0.100.0.raw
./clean-rootfs.sh $<
qemu-img convert -c -f raw $< -O qcow2 -o compression_type=zstd,compat=1.1 $@
/build/distro.qcow2.xz: /build/distro.qcow2
xz -9 --extreme --stdout $< > $@
# Recompress the tarball kiwi leaves behind. Kiwi runs xz in threaded
# mode with 24 MiB blocks, which loses a meaningful chunk of ratio to
# block boundaries; a single xz -9 --extreme pass is ~14% smaller.
/build/distro.tar.xz: /build/rancher-desktop-distro.$(ARCH)-0.100.0.tar.xz
xz --decompress --stdout $< | xz -9 --extreme > $@
.INTERMEDIATE: /build/distro.qcow2
.DELETE_ON_ERROR: # Avoid half-downloaded files