1 Star 0 Fork 59

dracoding / process1

forked from openEuler / sysmaster 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
docker-run.sh 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
hexiaowen 提交于 2021-10-26 09:47 . 优化docker构建测试时间
#!/bin/bash
#1.check cargo musl build
#echo -e "---!!!CHECK CARGO AND DOCKER!!!---"
rustup show | grep -i x86_64-unknown-linux-musl > /dev/null 2>&1
if [ $? -ne 0 ]; then
cat << EOF
你的环境缺少rust构建工具, 你可以:
1.安装rust环境...
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
2.安装x86_64-unknown-linux-musl...
rustup target add x86_64-unknown-linux-musl
3.安装musl-gcc...
dnf install musl-gcc -y
EOF
exit 1
fi
#!.check docker
docker -v > /dev/null 2>&1
if [ $? -ne 0 ]; then
cat << EOF
你的环境缺少docker工具, 你可以:
1.安装docker环境...
dnf install docker -y
curl -sSL https://get.docker.com | sh
2.开启docker服务
systemctl start docker; systemctl enable docker
3.如果不支持cgroupv2, 修改后重启系统
sudo dnf install -y grubby ; sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
EOF
exit 1
fi
#!.build
echo -e "---!!!CARGO BUILD!!!---"
cargo build --target x86_64-unknown-linux-musl || exit 1
#!.docker build
echo -e "\n\n\n---!!!DOCKER BUILD!!!---"
docker stop prun
docker rmi process1 -f > /dev/null 2>&1
docker build --no-cache --tag process1 `pwd` || exit 1
#!.docker run
echo -e "\n\n\n---!!!RUN PROCESS1 IN DOCKER!!!---"
docker run --rm --name prun --privileged -ti process1 init $* || exit 1
1
https://gitee.com/dracoding/process1.git
git@gitee.com:dracoding/process1.git
dracoding
process1
process1
master

搜索帮助