支持使用docker进行构建

This commit is contained in:
fslongjin 2022-07-25 19:32:50 +08:00
parent 2057c77f5a
commit 63c40fec13
3 changed files with 14 additions and 8 deletions

9
run.sh
View File

@ -8,8 +8,13 @@
# 第一个参数如果是--notbuild 那就不构建,直接运行
if [ ! "$1" == "--nobuild" ]; then
echo "开始构建..."
make all -j 16
make clean
if [ "$1" == "--docker" ]; then
echo "使用docker构建"
sudo bash tools/build_in_docker.sh
else
make all -j 16
make clean
fi
fi
IA32_USE_QEMU=1

View File

@ -1,6 +0,0 @@
FROM debian:bullseye
RUN apt update \
&& apt install -y git xorriso build-essential
VOLUME ["/user_data"]
CMD tail -f /dev/null

7
tools/build_in_docker.sh Normal file
View File

@ -0,0 +1,7 @@
docker rm -f dragonos-build
p=`pwd`
cpu_count=$(cat /proc/cpuinfo |grep "processor"|wc -l)
docker run -v $p:/data --name dragonos-build -i dragonos-dev:v1.0 bash << EOF
cd /data
make -j ${cpu_count}
EOF