build: Remove DragonOS_GCC And make CI use docker image (#954)

* build: 不再需要x86_64-elf-gcc的支持
* ci: 添加ci用的docker镜像
* 切换workflow到构建用的容器上

---------

Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
LoGin
2024-10-10 00:59:50 +08:00
committed by GitHub
parent 1bd12bc2ff
commit 415e46ea47
37 changed files with 260 additions and 921 deletions

View File

@ -1,53 +1,27 @@
FROM debian:bullseye
FROM ubuntu:jammy
# 设置环境变量
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 设置工作目录
WORKDIR /build-image
WORKDIR /tmp
# 将本地的脚本复制到工作目录
COPY *.sh ./
# 设置用来存放rust缓存的卷
VOLUME [ "/root/.cargo/registry" ]
# 设置sudo免密码
RUN apt update && \
apt install -y ca-certificates curl gnupg wget sudo apt-utils && \
bash bootstrap.sh --default && \
sudo cp /tmp/docker-entrypoint.sh /root/entrypoint.sh && \
sudo chmod a+rwx /root/entrypoint.sh && \
sudo apt autoremove -q -y && \
sudo apt clean -q -y && \
sudo rm -rf /tmp/*
# 设置rust源的环境变量
ENV RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
ENV RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
WORKDIR /root
RUN sed -i "s@http://\(deb\|security\).debian.org@http://mirrors.ustc.edu.cn@g" /etc/apt/sources.list && apt update && apt install -y \
ca-certificates \
curl \
gnupg \
lsb-release \
llvm-dev libclang-dev clang gcc-multilib \
gcc build-essential fdisk dosfstools qemu-kvm \
sudo wget
# 安装Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -y && \
# You have to add the rustup variables to the $PATH
echo "export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> ~/.bashrc && \
bash -c "source $HOME/.cargo/env && \
# 更换cargo的索引源
touch $HOME/.cargo/config && \
bash change_rust_src.sh && \
# 安装rust的编译工具
echo "正在安装DragonOS所需的rust组件...首次安装需要一些时间来更新索引,请耐心等待..." && \
cargo install cargo-binutils && \
rustup toolchain install nightly && \
rustup default nightly && \
rustup component add rust-src && \
rustup component add llvm-tools-preview && \
rustup target add x86_64-unknown-none"
# 编译安装GCC交叉编译工具链
RUN bash build_gcc_toolchain.sh -f
# 清除缓存
WORKDIR /
RUN apt-get autoremove -q -y && \
apt-get clean -q -y && \
rm -rf /build-image
ENV DragonOS_GCC=/root/opt/dragonos-gcc/gcc-x86_64-unknown-none/bin/
ENTRYPOINT [ "/root/entrypoint.sh" ]
# 设置容器启动后执行的命令
CMD ["/bin/bash"]