Dockerfile 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. FROM ubuntu:22.04
  2. # SHELL ["/bin/bash", "-c"]
  3. LABEL email="liuyuqi<liuyuqi.gov@msn.cn>"
  4. ENV key=value
  5. WORKDIR /app
  6. # apt change to aliyun
  7. RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  8. RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  9. RUN apt update && apt install -y curl wget
  10. # COPY .cargo/config ~/.cargo/config
  11. # COPY .cargo/credentials ~/.cargo/credentials
  12. # install nodejs
  13. RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash
  14. RUN apt install -y nodejs
  15. RUN echo '\n\
  16. registry=http://registry.npm.taobao.org \n\
  17. sass_binary_site=https://npmmirror.com/mirrors/node-sass/ \n\
  18. electron_mirror=https://npmmirror.com/mirrors/electron/ \n\
  19. ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ \n\
  20. ' > ~/.npmrc
  21. RUN npm install -g yarn pnpm serve
  22. # install rust
  23. # 安装必要依赖与开发工具
  24. RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
  25. apt-get update && apt-get install -y \
  26. gcc-riscv64-unknown-elf gdb-multiarch dosfstools cmake \
  27. git wget python3 vim file curl \
  28. autoconf automake autotools-dev libmpc-dev libmpfr-dev libgmp-dev \
  29. gawk build-essential bison flex texinfo gperf libtool patchutils bc \
  30. zlib1g-dev libexpat-dev \
  31. ninja-build pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev
  32. # && rm -rf /var/lib/apt/lists/*
  33. #tauri deps
  34. RUN apt install -y libwebkit2gtk-4.0-dev \
  35. libssl-dev \
  36. libgtk-3-dev \
  37. libayatana-appindicator3-dev \
  38. librsvg2-dev
  39. # 安装 QEMU
  40. ARG QEMU_VERSION=7.0.0
  41. RUN cd /tmp && \
  42. wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz && \
  43. tar xf qemu-${QEMU_VERSION}.tar.xz && \
  44. cd qemu-${QEMU_VERSION} && \
  45. ./configure --target-list=riscv64-softmmu,riscv64-linux-user && \
  46. make -j && \
  47. make install && \
  48. cd .. && \
  49. rm -rf qemu-${QEMU_VERSION} qemu-${QEMU_VERSION}.tar.xz
  50. ARG RUST_VERSION=nightly
  51. ENV RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
  52. ENV RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
  53. RUN mkdir -p ~/.cargo && \
  54. echo '[source.crates-io]' >> ~/.cargo/config && \
  55. echo 'replace-with = "aliyun"' >> ~/.cargo/config && \
  56. echo '[source.aliyun]' >> ~/.cargo/config && \
  57. echo 'registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"' >> ~/.cargo/config && \
  58. echo '[source.ustc]' >> ~/.cargo/config && \
  59. echo 'registry = "https://mirrors.ustc.edu.cn/crates.io-index"' >> ~/.cargo/config && \
  60. echo '[source.sjtu]' >> ~/.cargo/config && \
  61. echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index/"' >> ~/.cargo/config && \
  62. echo '[source.tuna]' >> ~/.cargo/config && \
  63. echo 'registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"' >> ~/.cargo/config && \
  64. echo '[source.rustcc]' >> ~/.cargo/config && \
  65. echo 'registry = "https://code.aliyun.com/rustcc/crates.io-index.git"' >> ~/.cargo/config
  66. # RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable && \
  67. # cargo install cargo-binutils && \
  68. # rustup component add llvm-tools-preview && \
  69. # rustup component add rust-src
  70. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh &&\
  71. sh rustup.sh -y --profile minimal &&\
  72. PATH=$PATH:/root/.cargo/bin &&\
  73. rustup target add riscv32i-unknown-none-elf &&\
  74. rustup component add llvm-tools-preview