mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 20:24:31 +00:00
osbuilder: Revert to using apk.static for Alpine
#2399 partially reverted #418, missing on returning to bootstrapping a rootfs with `apk.static` instead of copying the entire root, which can result in drastically larger (more than 10x) images. Revert this as well (requires some updates to URL building). Fixes: #3216 Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
parent
7522109abc
commit
dfd0732ff9
@ -11,7 +11,7 @@ BASE_PACKAGES="alpine-base"
|
||||
|
||||
# Alpine mirror to use
|
||||
# See a list of mirrors at http://nl.alpinelinux.org/alpine/MIRRORS.txt
|
||||
MIRROR=http://dl-5.alpinelinux.org/alpine
|
||||
MIRROR=https://dl-5.alpinelinux.org/alpine
|
||||
|
||||
PACKAGES=""
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
#
|
||||
# - Optional environment variables
|
||||
#
|
||||
# EXTRA_PKGS: Variable to add extra PKGS provided by the user
|
||||
#
|
||||
# BIN_AGENT: Name of the Kata-Agent binary
|
||||
#
|
||||
# Any other configuration variable for a specific distro must be added
|
||||
@ -22,13 +24,20 @@ build_rootfs() {
|
||||
# Mandatory
|
||||
local ROOTFS_DIR=$1
|
||||
|
||||
# Add extra packages to the rootfs when specified
|
||||
local EXTRA_PKGS=${EXTRA_PKGS:-}
|
||||
|
||||
# Populate ROOTFS_DIR
|
||||
check_root
|
||||
mkdir -p "${ROOTFS_DIR}"
|
||||
|
||||
rm -rf ${ROOTFS_DIR}/var/tmp
|
||||
cp -a -r -f /bin /etc /lib /sbin /usr /var ${ROOTFS_DIR}
|
||||
mkdir -p ${ROOTFS_DIR}{/root,/proc,/dev,/home,/media,/mnt,/opt,/run,/srv,/sys,/tmp}
|
||||
/sbin/apk.static \
|
||||
-X ${MIRROR}/v${OS_VERSION}/main \
|
||||
-U \
|
||||
--allow-untrusted \
|
||||
--root ${ROOTFS_DIR} \
|
||||
--initdb add ${BASE_PACKAGES} ${EXTRA_PKGS} ${PACKAGES}
|
||||
|
||||
echo "${MIRROR}/${OS_VERSION}/main" > ${ROOTFS_DIR}/etc/apk/repositories
|
||||
mkdir -p ${ROOTFS_DIR}{/root,/etc/apk,/proc}
|
||||
echo "${MIRROR}/v${OS_VERSION}/main" > ${ROOTFS_DIR}/etc/apk/repositories
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user