Skip to content

Commit da62259

Browse files
authored
Improve performance by using uncompressed snapshot and priming system (#27)
* .gitignore - Ignore all ./distro * build-files/build-image.sh - Install additional packages (e.g. gcc) * setup-build-env.sh - Create snapshot - Publish uncompressed snapshot - Prime filesystem by launching newly published image
1 parent 20b043a commit da62259

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
distro/
12
distro/*.tar.*
23
distro/rootfs_almalinux_*
34
distro/rootfs.squashfs

build-files/build-image.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ msg() {
1515
update_fresh_container() {
1616
header "Upgrading and installing packages"
1717
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq update -y >/dev/null
18-
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq install dotnet-sdk-8.0 -y >/dev/null
18+
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq install dotnet-sdk-8.0 make \
19+
gcc g++ autoconf automake m4 libtool -y >/dev/null
1920

2021
if [ $? -ne 0 ]; then
2122
exit 32

setup-build-env.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,17 @@ build_image_in_container() {
9292
lxc image delete ${IMAGE_ALIAS} 2>/dev/null
9393

9494
msg "Runner build complete. Creating image snapshot."
95-
lxc publish "${BUILD_CONTAINER}" -f --alias "${IMAGE_ALIAS}" description="GitHub Actions ${OS_NAME} ${OS_VERSION} Runner for ${ARCH}"
95+
lxc snapshot "${BUILD_CONTAINER}" "build-snapshot"
96+
lxc publish "${BUILD_CONTAINER}/build-snapshot" -f --alias "${IMAGE_ALIAS}" \
97+
--compression none \
98+
description="GitHub Actions ${OS_NAME} ${OS_VERSION} Runner for ${ARCH}"
9699

97100
msg "Export the image to ${EXPORT} for use elsewhere"
98101
lxc image export "${IMAGE_ALIAS}" ${EXPORT}
102+
103+
msg "Priming the filesystem by launching the newly built container"
104+
lxc launch "${IMAGE_ALIAS}" "primer"
105+
lxc rm -f primer
99106
else
100107
msg "Build process failed with RC: $? - review log to determine cause of failure" >&2
101108
fi

0 commit comments

Comments
 (0)