Slightly simplify the build
This commit is contained in:
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
||||
out/*.img.gz
|
||||
out/*.ext4.zst
|
||||
@@ -4,6 +4,8 @@ set -euo pipefail
|
||||
|
||||
/preload-k8s-images.sh || exit 1
|
||||
|
||||
export CTL_BIN_LAYER=$( skopeo inspect docker-daemon:localhost/monok8s/control-agent:dev | jq -r '.Layers[0] | sub("^sha256:"; "")' )
|
||||
|
||||
mkdir -p "$ROOTFS/var/cache/apk"
|
||||
mkdir -p "$ROOTFS/opt/monok8s/config"
|
||||
mkdir -p "$ROOTFS/build"
|
||||
@@ -25,7 +27,6 @@ mount --bind /run "$ROOTFS/run"
|
||||
cp /usr/bin/qemu-aarch64-static "$ROOTFS/usr/bin/"
|
||||
cp /etc/resolv.conf "$ROOTFS/etc/resolv.conf"
|
||||
cp /build/crio.tar.gz "$ROOTFS/build/"
|
||||
cp -r /build/rootfs/* "$ROOTFS/"
|
||||
|
||||
chroot "$ROOTFS" /bin/sh -c "ln -s /var/cache/apk /etc/apk/cache"
|
||||
# chroot "$ROOTFS" /bin/sh -c "apk update"
|
||||
|
||||
@@ -34,6 +34,15 @@ fi
|
||||
sed -i "s/default_runtime = \"crun\"/\0\ncgroup_manager = \"cgroupfs\"/g" /etc/crio/crio.conf.d/10-crio.conf
|
||||
grep cgroup_manager /etc/crio/crio.conf.d/10-crio.conf || exit 1
|
||||
|
||||
echo "##################################################### Installing Control Agent"
|
||||
CTL_BIN=$(find /usr/lib/monok8s/imagestore -name "ctl" | grep "$CTL_BIN_LAYER")
|
||||
if [ -z "$CTL_BIN" ]; then
|
||||
echo "Unable to locate the control agent binary"
|
||||
exit 1
|
||||
fi
|
||||
ln -s "$CTL_BIN" /usr/local/bin/ctl
|
||||
|
||||
|
||||
mkdir -p /var/run/crio
|
||||
mkdir -p /var/lib/containers/storage
|
||||
mkdir -p /var/lib/cni
|
||||
|
||||
@@ -15,17 +15,18 @@ RUN mkdir -p "/out/rootfs"
|
||||
COPY packages/alpine-minirootfs-${ALPINE_VER}-${ALPINE_ARCH}.tar.gz ./alpine.tar.gz
|
||||
COPY packages/${CRIO_VERSION}.tar.gz ./crio.tar.gz
|
||||
COPY out/board.itb ./
|
||||
COPY out/rootfs ./rootfs
|
||||
COPY out/rootfs.tar.gz ./rootfs.tar.gz
|
||||
COPY out/${DEVICE_TREE_TARGET}.dtb ./
|
||||
COPY out/Image.gz ./
|
||||
|
||||
RUN tar -xf alpine.tar.gz -C "/out/rootfs"
|
||||
RUN tar zxf rootfs.tar.gz -C "/out"
|
||||
RUN tar zxf alpine.tar.gz -C "/out/rootfs"
|
||||
|
||||
RUN mkdir -p /out/rootfs/usr/local/bin/
|
||||
COPY packages/kubernetes/kubelet-${KUBE_VERSION} /out/rootfs/usr/local/bin/kubelet
|
||||
COPY packages/kubernetes/kubeadm-${KUBE_VERSION} /out/rootfs/usr/local/bin/kubeadm
|
||||
COPY packages/kubernetes/kubectl-${KUBE_VERSION} /out/rootfs/usr/local/bin/kubectl
|
||||
COPY clitools/bin/ctl-linux-${ALPINE_ARCH}-${TAG} /out/rootfs/usr/local/bin/ctl
|
||||
# COPY clitools/bin/ctl-linux-${ALPINE_ARCH}-${TAG} /out/rootfs/usr/local/bin/ctl
|
||||
RUN chmod +x /out/rootfs/usr/local/bin/*
|
||||
|
||||
COPY alpine/rootfs-extra ./rootfs-extra
|
||||
|
||||
@@ -21,6 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
flex \
|
||||
git \
|
||||
gettext-base \
|
||||
jq \
|
||||
kmod \
|
||||
libelf-dev \
|
||||
libssl-dev \
|
||||
|
||||
@@ -47,6 +47,7 @@ RUN depmod -b /out/rootfs $(ls /out/rootfs/lib/modules/)
|
||||
|
||||
RUN find /out/kernel -name "${DEVICE_TREE_TARGET}.dtb" -exec cp {} /out/ \;
|
||||
RUN test -f "/out/${DEVICE_TREE_TARGET}.dtb"
|
||||
RUN cd /out && tar zcf rootfs.tar.gz rootfs
|
||||
|
||||
FROM scratch
|
||||
ARG DEVICE_TREE_TARGET
|
||||
@@ -57,4 +58,4 @@ COPY --from=build \
|
||||
/out/kernel/Image.gz \
|
||||
/out/${DEVICE_TREE_TARGET}.dtb \
|
||||
./
|
||||
COPY --from=build /out/rootfs/ ./rootfs
|
||||
COPY --from=build /out/rootfs.tar.gz ./rootfs.tar.gz
|
||||
|
||||
Reference in New Issue
Block a user