mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 14:08:31 +00:00
osbuilder: Remove musl installations
Remove a lot of cruft of musl installations -- we needed those for the Go agent, but Rustup just takes care of everything. aarch64 on Debian-based & Alpine is an exception -- create a symlink `aarch64-linux-musl-gcc` to `musl-tools`'s `musl-gcc` or `gcc` on Alpine. This is unified -- arch-specific Dockerfiles are removed. Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
parent
5c3e553624
commit
0072cc2b66
@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2020 Ant Group
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
install_aarch64_musl() {
|
||||
local arch=$(uname -m)
|
||||
if [ "${arch}" == "aarch64" ]; then
|
||||
local musl_tar="${arch}-linux-musl-native.tgz"
|
||||
local musl_dir="${arch}-linux-musl-native"
|
||||
pushd /tmp
|
||||
if curl -sLO --fail https://musl.cc/${musl_tar}; then
|
||||
tar -zxf ${musl_tar}
|
||||
mkdir -p /usr/local/musl/
|
||||
cp -r ${musl_dir}/* /usr/local/musl/
|
||||
fi
|
||||
popd
|
||||
fi
|
||||
}
|
||||
|
||||
install_aarch64_musl
|
@ -36,7 +36,4 @@ RUN zypper --non-interactive refresh; \
|
||||
zypper --non-interactive clean --all;
|
||||
|
||||
|
||||
# This will install the proper golang to build Kata components
|
||||
@INSTALL_MUSL@
|
||||
@INSTALL_GO@
|
||||
@INSTALL_RUST@
|
||||
|
@ -26,3 +26,5 @@ RUN apk update && apk add --no-cache \
|
||||
musl-dev \
|
||||
protoc \
|
||||
tar
|
||||
# aarch64 requires this name -- link for all
|
||||
RUN ln -s /usr/bin/gcc "/usr/bin/$(uname -m)-linux-musl-gcc"
|
||||
|
@ -37,5 +37,4 @@ RUN dnf -y update && dnf install -y \
|
||||
dnf clean all
|
||||
|
||||
# This will install the proper packages to build Kata components
|
||||
@INSTALL_MUSL@
|
||||
@INSTALL_RUST@
|
||||
|
@ -1,34 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2020 ARM Limited
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
ARG IMAGE_REGISTRY=docker.io
|
||||
# NOTE: OS_VERSION is set according to config.sh
|
||||
FROM ${IMAGE_REGISTRY}/debian:@OS_VERSION@
|
||||
|
||||
# RUN commands
|
||||
RUN apt-get update && apt-get install -y \
|
||||
autoconf \
|
||||
automake \
|
||||
binutils \
|
||||
build-essential \
|
||||
chrony \
|
||||
coreutils \
|
||||
curl \
|
||||
debianutils \
|
||||
debootstrap \
|
||||
g++ \
|
||||
gcc \
|
||||
git \
|
||||
libc-dev \
|
||||
libstdc++-8-dev \
|
||||
m4 \
|
||||
make \
|
||||
sed \
|
||||
systemd \
|
||||
tar \
|
||||
vim
|
||||
# This will install the proper packages to build Kata components
|
||||
@INSTALL_MUSL@
|
||||
@INSTALL_RUST@
|
@ -27,14 +27,14 @@ RUN apt-get update && apt-get --no-install-recommends install -y \
|
||||
libstdc++-8-dev \
|
||||
m4 \
|
||||
make \
|
||||
musl \
|
||||
musl-dev \
|
||||
musl-tools \
|
||||
sed \
|
||||
systemd \
|
||||
tar \
|
||||
vim \
|
||||
wget
|
||||
# aarch64 requires this name -- link for all
|
||||
RUN ln -s /usr/bin/musl-gcc "/usr/bin/$(uname -m)-linux-musl-gcc"
|
||||
|
||||
# This will install the proper packages to build Kata components
|
||||
@INSTALL_RUST@
|
||||
|
@ -14,7 +14,6 @@ script_name="${0##*/}"
|
||||
script_dir="$(dirname $(readlink -f $0))"
|
||||
AGENT_VERSION=${AGENT_VERSION:-}
|
||||
RUST_VERSION="null"
|
||||
MUSL_VERSION=${MUSL_VERSION:-"null"}
|
||||
AGENT_BIN=${AGENT_BIN:-kata-agent}
|
||||
AGENT_INIT=${AGENT_INIT:-no}
|
||||
KERNEL_MODULES_DIR=${KERNEL_MODULES_DIR:-""}
|
||||
@ -335,11 +334,6 @@ build_rootfs_distro()
|
||||
|
||||
echo "Required rust version: $RUST_VERSION"
|
||||
|
||||
detect_musl_version ||
|
||||
die "Could not detect the required musl version for AGENT_VERSION='${AGENT_VERSION:-main}'."
|
||||
|
||||
echo "Required musl version: $MUSL_VERSION"
|
||||
|
||||
if [ -z "${USE_DOCKER}" ] && [ -z "${USE_PODMAN}" ]; then
|
||||
info "build directly"
|
||||
build_rootfs ${ROOTFS_DIR}
|
||||
@ -544,7 +538,6 @@ EOT
|
||||
LIBC=gnu
|
||||
echo "WARNING: Forcing LIBC=gnu because $ARCH has no musl Rust target"
|
||||
fi
|
||||
[ "$LIBC" == "musl" ] && bash ${script_dir}/../../../ci/install_musl.sh
|
||||
test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env"
|
||||
# rust agent needs ${arch}-unknown-linux-${LIBC}
|
||||
if ! (rustup show | grep -v linux-${LIBC} > /dev/null); then
|
||||
@ -555,7 +548,6 @@ EOT
|
||||
bash ${script_dir}/../../../ci/install_rust.sh ${RUST_VERSION}
|
||||
fi
|
||||
test -r "${HOME}/.cargo/env" && source "${HOME}/.cargo/env"
|
||||
[ "$ARCH" == "aarch64" ] && OLD_PATH=$PATH && export PATH=$PATH:/usr/local/musl/bin
|
||||
|
||||
agent_dir="${script_dir}/../../../src/agent/"
|
||||
|
||||
@ -577,7 +569,6 @@ EOT
|
||||
make clean
|
||||
make LIBC=${LIBC} INIT=${AGENT_INIT} SECCOMP=${SECCOMP}
|
||||
make install DESTDIR="${ROOTFS_DIR}" LIBC=${LIBC} INIT=${AGENT_INIT}
|
||||
[ "$ARCH" == "aarch64" ] && export PATH=$OLD_PATH && rm -rf /usr/local/musl
|
||||
if [ "${SECCOMP}" == "yes" ]; then
|
||||
rm -rf "${libseccomp_install_dir}" "${gperf_install_dir}"
|
||||
fi
|
||||
|
@ -14,5 +14,4 @@ FROM ${IMAGE_REGISTRY}/@distro@:@OS_VERSION@
|
||||
# RUN commands
|
||||
|
||||
# This will install the proper packages to build Kata components
|
||||
@INSTALL_MUSL@
|
||||
@INSTALL_RUST@
|
||||
|
@ -1,43 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2020 ARM Limited
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
ARG IMAGE_REGISTRY=docker.io
|
||||
#ubuntu: docker image to be used to create a rootfs
|
||||
#@OS_VERSION@: Docker image version to build this dockerfile
|
||||
FROM ${IMAGE_REGISTRY}/ubuntu:@OS_VERSION@
|
||||
|
||||
# This dockerfile needs to provide all the componets need to build a rootfs
|
||||
# Install any package need to create a rootfs (package manager, extra tools)
|
||||
|
||||
# Avoid tzdata setup
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
# RUN commands
|
||||
RUN apt-get update && apt-get install -y \
|
||||
autoconf \
|
||||
automake \
|
||||
binutils \
|
||||
build-essential \
|
||||
chrony \
|
||||
coreutils \
|
||||
curl \
|
||||
debianutils \
|
||||
debootstrap \
|
||||
g++ \
|
||||
gcc \
|
||||
git \
|
||||
libc6-dev \
|
||||
libstdc++-8-dev \
|
||||
m4 \
|
||||
make \
|
||||
sed \
|
||||
systemd \
|
||||
tar \
|
||||
vim && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/
|
||||
|
||||
# This will install the proper packages to build Kata components
|
||||
@INSTALL_MUSL@
|
||||
@INSTALL_RUST@
|
@ -31,8 +31,6 @@ RUN apt-get update && apt-get --no-install-recommends install -y \
|
||||
libstdc++-8-dev \
|
||||
m4 \
|
||||
make \
|
||||
musl \
|
||||
musl-dev \
|
||||
musl-tools \
|
||||
protobuf-compiler \
|
||||
sed \
|
||||
@ -40,6 +38,8 @@ RUN apt-get update && apt-get --no-install-recommends install -y \
|
||||
tar \
|
||||
vim \
|
||||
wget
|
||||
# aarch64 requires this name -- link for all
|
||||
RUN ln -s /usr/bin/musl-gcc "/usr/bin/$(uname -m)-linux-musl-gcc"
|
||||
|
||||
# This will install the proper packages to build Kata components
|
||||
@INSTALL_RUST@
|
||||
|
@ -7,7 +7,6 @@
|
||||
set -e
|
||||
|
||||
KATA_REPO=${KATA_REPO:-github.com/kata-containers/kata-containers}
|
||||
MUSL_VERSION=${MUSL_VERSION:-"null"}
|
||||
# Give preference to variable set by CI
|
||||
yq_file="${script_dir}/../../../ci/install_yq.sh"
|
||||
kata_versions_file="${script_dir}/../../../versions.yaml"
|
||||
@ -204,68 +203,12 @@ generate_dockerfile()
|
||||
dir="$1"
|
||||
[ -d "${dir}" ] || die "${dir}: not a directory"
|
||||
|
||||
local architecture=$(uname -m)
|
||||
local rustarch=${architecture}
|
||||
local muslarch=${architecture}
|
||||
local libc=musl
|
||||
case "$(uname -m)" in
|
||||
"ppc64le")
|
||||
rustarch=powerpc64le
|
||||
muslarch=powerpc64
|
||||
libc=gnu
|
||||
;;
|
||||
"s390x")
|
||||
libc=gnu
|
||||
;;
|
||||
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
local rustarch=$(uname -m)
|
||||
[ "$rustarch" = ppc64le ] && rustarch=powerpc64le
|
||||
|
||||
[ -n "${http_proxy:-}" ] && readonly set_proxy="RUN sed -i '$ a proxy="${http_proxy:-}"' /etc/dnf/dnf.conf /etc/yum.conf; true"
|
||||
|
||||
# Rust agent
|
||||
# rust installer should set path apropiately, just in case
|
||||
# install musl for compiling rust-agent
|
||||
local musl_source_url="https://git.zv.io/toolchains/musl-cross-make.git"
|
||||
local musl_source_dir="musl-cross-make"
|
||||
install_musl=
|
||||
if [ "${muslarch}" == "aarch64" ]; then
|
||||
local musl_tar="${muslarch}-linux-musl-native.tgz"
|
||||
local musl_dir="${muslarch}-linux-musl-native"
|
||||
local aarch64_musl_target="aarch64-linux-musl"
|
||||
install_musl="
|
||||
RUN cd /tmp; \
|
||||
mkdir -p /usr/local/musl/; \
|
||||
if curl -sLO --fail https://musl.cc/${musl_tar}; then \
|
||||
tar -zxf ${musl_tar}; \
|
||||
cp -r ${musl_dir}/* /usr/local/musl/; \
|
||||
else \
|
||||
git clone ${musl_source_url}; \
|
||||
TARGET=${aarch64_musl_target} make -j$(nproc) -C ${musl_source_dir} install; \
|
||||
cp -r ${musl_source_dir}/output/* /usr/local/musl/; \
|
||||
cp /usr/local/musl/bin/aarch64-linux-musl-g++ /usr/local/musl/bin/g++; \
|
||||
fi
|
||||
ENV PATH=\$PATH:/usr/local/musl/bin
|
||||
RUN ln -sf /usr/local/musl/bin/g++ /usr/bin/g++
|
||||
"
|
||||
else
|
||||
local musl_tar="musl-${MUSL_VERSION}.tar.gz"
|
||||
local musl_dir="musl-${MUSL_VERSION}"
|
||||
install_musl="
|
||||
RUN pushd /root; \
|
||||
curl -sLO https://www.musl-libc.org/releases/${musl_tar}; tar -zxf ${musl_tar}; \
|
||||
cd ${musl_dir}; \
|
||||
sed -i \"s/^ARCH = .*/ARCH = ${muslarch}/g\" dist/config.mak; \
|
||||
./configure > /dev/null 2>\&1; \
|
||||
make > /dev/null 2>\&1; \
|
||||
make install > /dev/null 2>\&1; \
|
||||
echo \"/usr/local/musl/lib\" > /etc/ld-musl-${muslarch}.path; \
|
||||
popd
|
||||
ENV PATH=\$PATH:/usr/local/musl/bin
|
||||
"
|
||||
fi
|
||||
|
||||
readonly install_rust="
|
||||
RUN curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSLf --output /tmp/rust-init; \
|
||||
chmod a+x /tmp/rust-init; \
|
||||
@ -280,31 +223,12 @@ RUN . /root/.cargo/env; \
|
||||
RUN ln -sf /usr/bin/g++ /bin/musl-g++
|
||||
"
|
||||
pushd "${dir}"
|
||||
dockerfile_template="Dockerfile.in"
|
||||
dockerfile_arch_template="Dockerfile-${architecture}.in"
|
||||
# if arch-specific docker file exists, swap the univesal one with it.
|
||||
if [ -f "${dockerfile_arch_template}" ]; then
|
||||
dockerfile_template="${dockerfile_arch_template}"
|
||||
else
|
||||
[ -f "${dockerfile_template}" ] || die "${dockerfile_template}: file not found"
|
||||
fi
|
||||
|
||||
# ppc64le and s390x have no musl target
|
||||
if [ "${architecture}" == "ppc64le" ] || [ "${architecture}" == "s390x" ]; then
|
||||
sed \
|
||||
-e "s|@OS_VERSION@|${OS_VERSION:-}|g" \
|
||||
-e "s|@INSTALL_MUSL@||g" \
|
||||
-e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \
|
||||
-e "s|@SET_PROXY@|${set_proxy:-}|g" \
|
||||
"${dockerfile_template}" > Dockerfile
|
||||
else
|
||||
sed \
|
||||
-e "s|@OS_VERSION@|${OS_VERSION:-}|g" \
|
||||
-e "s|@INSTALL_MUSL@|${install_musl//$'\n'/\\n}|g" \
|
||||
-e "s|@INSTALL_RUST@|${install_rust//$'\n'/\\n}|g" \
|
||||
-e "s|@SET_PROXY@|${set_proxy:-}|g" \
|
||||
"${dockerfile_template}" > Dockerfile
|
||||
fi
|
||||
sed \
|
||||
-e "s#@OS_VERSION@#${OS_VERSION:-}#g" \
|
||||
-e "s#@INSTALL_RUST@#${install_rust//$'\n'/\\n}#g" \
|
||||
-e "s#@SET_PROXY@#${set_proxy:-}#g" \
|
||||
Dockerfile.in > Dockerfile
|
||||
popd
|
||||
}
|
||||
|
||||
@ -345,17 +269,6 @@ detect_rust_version()
|
||||
[ -n "$RUST_VERSION" ]
|
||||
}
|
||||
|
||||
detect_musl_version()
|
||||
{
|
||||
info "Detecting musl version"
|
||||
local yq_path="externals.musl.version"
|
||||
|
||||
info "Get musl version from ${kata_versions_file}"
|
||||
MUSL_VERSION="$(get_package_version_from_kata_yaml "$yq_path")"
|
||||
|
||||
[ -n "$MUSL_VERSION" ]
|
||||
}
|
||||
|
||||
before_starting_container() {
|
||||
return 0
|
||||
}
|
||||
|
@ -640,8 +640,6 @@ test_dracut()
|
||||
die "Could not detect the required Go version for AGENT_VERSION='${AGENT_VERSION:-master}'."
|
||||
detect_rust_version ||
|
||||
die "Could not detect the required rust version for AGENT_VERSION='${AGENT_VERSION:-master}'."
|
||||
detect_musl_version ||
|
||||
die "Could not detect the required musl version for AGENT_VERSION='${AGENT_VERSION:-master}'."
|
||||
|
||||
generate_dockerfile ${dracut_dir}
|
||||
info "Creating container for dracut"
|
||||
|
@ -233,19 +233,6 @@ externals:
|
||||
.*/v?(\d\S+)\.tar\.gz
|
||||
version: "v1.0.1"
|
||||
|
||||
musl:
|
||||
description: |
|
||||
The musl library is used to build the rust agent.
|
||||
url: "https://www.musl-libc.org/"
|
||||
uscan-url: >-
|
||||
https://www.musl-libc.org/releases/
|
||||
musl-([\d\.]+)\.tar\.gz
|
||||
version: "1.1.23"
|
||||
meta:
|
||||
description: |
|
||||
'newest-version' is the latest version known to work.
|
||||
newest-version: "1.1.23"
|
||||
|
||||
nydus:
|
||||
description: "Nydus image acceleration service"
|
||||
url: "https://github.com/dragonflyoss/image-service"
|
||||
|
Loading…
Reference in New Issue
Block a user