mirror of
https://github.com/rancher/os.git
synced 2025-08-31 14:23:11 +00:00
Update build for docker-from-scratch
This commit is contained in:
@@ -10,18 +10,10 @@ VERSION=${VERSION:?"VERSION not set"}
|
||||
BUILD=${BUILD:?"BUILD not set"}
|
||||
|
||||
|
||||
CONTAINER_INITRDBASE=$(docker create rancher/os-initrdbase:${VERSION})
|
||||
cleanup_initrdbase() {
|
||||
docker rm -v ${CONTAINER_INITRDBASE}
|
||||
}
|
||||
trap cleanup_initrdbase EXIT
|
||||
docker cp ${CONTAINER_INITRDBASE}:/initrd ${BUILD} # copies files to ${BUILD}/initrd
|
||||
|
||||
|
||||
CONTAINER_KERNEL=$(docker create rancher/os-kernel:${VERSION})
|
||||
cleanup_kernel() {
|
||||
cleanup_initrdbase
|
||||
docker rm -v ${CONTAINER_KERNEL}
|
||||
}
|
||||
trap cleanup_kernel EXIT
|
||||
|
||||
docker cp ${CONTAINER_KERNEL}:/kernel ${BUILD} # copies files to ${BUILD}/kernel
|
||||
|
@@ -1,5 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
docker rm -fv ros-build > /dev/null 2>&1 || :
|
||||
exec docker run -v /var/run/docker.sock:/var/run/docker.sock --name=ros-build ros-build "$@"
|
||||
DOCKER_ARGS=
|
||||
if [ -n "$BIND_DIR" ]; then
|
||||
if [ "$BIND_DIR" = "." ]; then
|
||||
BIND_DIR=$(pwd)
|
||||
fi
|
||||
DOCKER_ARGS="-t -v $BIND_DIR:/go/src/github.com/rancherio/os"
|
||||
fi
|
||||
|
||||
docker rm -fv ros-build >/dev/null 2>&1 || true
|
||||
exec docker run -i -v /var/run/docker.sock:/var/run/docker.sock $DOCKER_ARGS --name=ros-build ros-build "$@"
|
||||
|
@@ -9,4 +9,4 @@ for i in `./ros c images -i os-config.yml`; do
|
||||
[ "${FORCE_PULL}" != "1" ] && docker inspect $i >/dev/null 2>&1 || docker pull $i;
|
||||
done
|
||||
|
||||
docker save `./ros c images -i os-config.yml` > ${INITRD_DIR}/images.tar
|
||||
docker save `./ros c images -i os-config.yml` > ${BUILD}/images.tar
|
||||
|
@@ -4,8 +4,22 @@ set -ex
|
||||
cd $(dirname $0)/..
|
||||
. scripts/build-common
|
||||
|
||||
mv ${BUILD}/kernel/lib ${INITRD_DIR}
|
||||
mv assets/docker ${INITRD_DIR}
|
||||
cp os-config.yml ${INITRD_DIR}
|
||||
cp bin/rancheros ${INITRD_DIR}/init
|
||||
rm -rf ${INITRD_DIR}/{usr,init}
|
||||
mkdir -p ${INITRD_DIR}/usr/{bin,share/ros}
|
||||
|
||||
cp -rf ${BUILD}/kernel/lib ${INITRD_DIR}/usr
|
||||
cp assets/docker ${INITRD_DIR}/usr/bin/docker
|
||||
cp ${BUILD}/images.tar ${INITRD_DIR}/usr/share/ros
|
||||
cp os-config.yml ${INITRD_DIR}/usr/share/ros/
|
||||
cp bin/rancheros ${INITRD_DIR}/usr/bin/ros
|
||||
ln -s usr/bin/ros ${INITRD_DIR}/init
|
||||
|
||||
docker export $(docker create rancher/docker:1.8.0-rc2) | tar xvf - -C ${INITRD_DIR} --exclude=usr/bin/dockerlaunch \
|
||||
--exclude=usr/bin/docker \
|
||||
--exclude=usr/share/git-core \
|
||||
--exclude=usr/bin/git \
|
||||
--exclude=usr/bin/ssh \
|
||||
--exclude=usr/libexec/git-core \
|
||||
usr
|
||||
|
||||
cd ${INITRD_DIR} && find | cpio -H newc -o | lzma -c > ${DIST}/artifacts/initrd
|
||||
|
@@ -4,6 +4,8 @@ set -ex
|
||||
cd $(dirname $0)/..
|
||||
. scripts/build-common
|
||||
|
||||
mkdir -p ${CD}/boot/isolinux
|
||||
|
||||
cp ${DIST}/artifacts/initrd ${CD}/boot
|
||||
cp ${DIST}/artifacts/vmlinuz ${CD}/boot
|
||||
cp scripts/isolinux.cfg ${CD}/boot/isolinux
|
||||
|
@@ -60,7 +60,6 @@ if [ ! -d ${INITRD_TMP} ]; then
|
||||
else
|
||||
xz -dc ${INITRD} | cpio -idmv
|
||||
fi
|
||||
rm -f init
|
||||
popd
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user