Dockerfile 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. FROM ubuntu:22.04
  2. SHELL ["/bin/bash", "-c"]
  3. # 安装必要依赖与开发工具
  4. RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
  5. apt-get update && apt-get install -y \
  6. gcc-riscv64-unknown-elf gdb-multiarch dosfstools cmake \
  7. git wget python3 vim file curl \
  8. autoconf automake autotools-dev libmpc-dev libmpfr-dev libgmp-dev \
  9. gawk build-essential bison flex texinfo gperf libtool patchutils bc \
  10. zlib1g-dev libexpat-dev \
  11. ninja-build pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev \
  12. && rm -rf /var/lib/apt/lists/*
  13. # 安装 QEMU
  14. ARG QEMU_VERSION=7.0.0
  15. RUN cd /tmp && \
  16. wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz && \
  17. tar xf qemu-${QEMU_VERSION}.tar.xz && \
  18. cd qemu-${QEMU_VERSION} && \
  19. ./configure --target-list=riscv64-softmmu,riscv64-linux-user && \
  20. make -j && \
  21. make install && \
  22. cd .. && \
  23. rm -rf qemu-${QEMU_VERSION} qemu-${QEMU_VERSION}.tar.xz
  24. # 安装 code-server 和扩展
  25. ARG CODE_VERSION=4.10.1
  26. RUN cd /usr/local/ && \
  27. wget https://github.com/coder/code-server/releases/download/v${CODE_VERSION}/code-server-${CODE_VERSION}-linux-amd64.tar.gz && \
  28. tar xf code-server-${CODE_VERSION}-linux-amd64.tar.gz && \
  29. ln -s /usr/local/code-server-${CODE_VERSION}-linux-amd64/bin/code-server /usr/bin/code && \
  30. rm code-server-${CODE_VERSION}-linux-amd64.tar.gz && \
  31. wget https://openvsxorg.blob.core.windows.net/resources/rust-lang/rust-analyzer/linux-x64/0.3.1435/rust-lang.rust-analyzer-0.3.1435@linux-x64.vsix && \
  32. code --install-extension rust-lang.rust-analyzer-0.3.1435@linux-x64.vsix && \
  33. rm rust-lang.rust-analyzer-0.3.1435@linux-x64.vsix && \
  34. wget https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hans/1.75.0/file/MS-CEINTL.vscode-language-pack-zh-hans-1.75.0.vsix && \
  35. code --install-extension MS-CEINTL.vscode-language-pack-zh-hans-1.75.0.vsix && \
  36. rm MS-CEINTL.vscode-language-pack-zh-hans-1.75.0.vsix
  37. WORKDIR /root
  38. # 安装 rust
  39. ARG RUST_VERSION=nightly
  40. ENV RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
  41. ENV RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
  42. RUN mkdir .cargo && \
  43. echo '[source.crates-io]' >> .cargo/config && \
  44. echo 'registry = "https://github.com/rust-lang/crates.io-index"' >> .cargo/config && \
  45. echo 'replace-with = "ustc"' >> .cargo/config && \
  46. echo '[source.ustc]' >> .cargo/config && \
  47. echo 'registry = "git://mirrors.ustc.edu.cn/crates.io-index"' >> .cargo/config && \
  48. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs -o rustup-init && \
  49. chmod +x rustup-init && \
  50. ./rustup-init -y --default-toolchain ${RUST_VERSION} --target riscv64imac-unknown-none-elf && \
  51. rm rustup-init && \
  52. cargo install cargo-binutils && \
  53. rustup component add llvm-tools-preview && \
  54. rustup component add rust-src
  55. EXPOSE 8080/tcp
  56. CMD ["code", "--auth", "none", "--bind-addr", "0.0.0.0:8080"]
  57. FROM ubuntu:22.04
  58. # SHELL ["/bin/bash", "-c"]
  59. LABEL email="liuyuqi<liuyuqi.gov@msn.cn>"
  60. ENV key=value
  61. WORKDIR /app
  62. # apt change to aliyun
  63. RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  64. RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  65. RUN apt update && apt install -y curl wget
  66. # COPY .cargo/config ~/.cargo/config
  67. # COPY .cargo/credentials ~/.cargo/credentials
  68. # install nodejs
  69. RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash
  70. RUN apt install -y nodejs
  71. RUN echo '\n\
  72. registry=http://registry.npm.taobao.org \n\
  73. sass_binary_site=https://npmmirror.com/mirrors/node-sass/ \n\
  74. electron_mirror=https://npmmirror.com/mirrors/electron/ \n\
  75. ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ \n\
  76. ' > ~/.npmrc
  77. RUN npm install -g yarn pnpm serve
  78. # install rust
  79. # 安装必要依赖与开发工具
  80. RUN sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list && \
  81. apt-get update && apt-get install -y \
  82. gcc-riscv64-unknown-elf gdb-multiarch dosfstools cmake \
  83. git wget python3 vim file curl \
  84. autoconf automake autotools-dev libmpc-dev libmpfr-dev libgmp-dev \
  85. gawk build-essential bison flex texinfo gperf libtool patchutils bc \
  86. zlib1g-dev libexpat-dev \
  87. ninja-build pkg-config libglib2.0-dev libpixman-1-dev libsdl2-dev
  88. # && rm -rf /var/lib/apt/lists/*
  89. #tauri deps
  90. RUN apt install -y libwebkit2gtk-4.0-dev \
  91. libssl-dev \
  92. libgtk-3-dev \
  93. libayatana-appindicator3-dev \
  94. librsvg2-dev
  95. # 安装 QEMU
  96. ARG QEMU_VERSION=7.0.0
  97. RUN cd /tmp && \
  98. wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz && \
  99. tar xf qemu-${QEMU_VERSION}.tar.xz && \
  100. cd qemu-${QEMU_VERSION} && \
  101. ./configure --target-list=riscv64-softmmu,riscv64-linux-user && \
  102. make -j && \
  103. make install && \
  104. cd .. && \
  105. rm -rf qemu-${QEMU_VERSION} qemu-${QEMU_VERSION}.tar.xz
  106. ARG RUST_VERSION=nightly
  107. ENV RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
  108. ENV RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
  109. RUN mkdir -p ~/.cargo && \
  110. echo '[source.crates-io]' >> ~/.cargo/config && \
  111. echo 'replace-with = "aliyun"' >> ~/.cargo/config && \
  112. echo '[source.aliyun]' >> ~/.cargo/config && \
  113. echo 'registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"' >> ~/.cargo/config && \
  114. echo '[source.ustc]' >> ~/.cargo/config && \
  115. echo 'registry = "https://mirrors.ustc.edu.cn/crates.io-index"' >> ~/.cargo/config && \
  116. echo '[source.sjtu]' >> ~/.cargo/config && \
  117. echo 'registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index/"' >> ~/.cargo/config && \
  118. echo '[source.tuna]' >> ~/.cargo/config && \
  119. echo 'registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"' >> ~/.cargo/config && \
  120. echo '[source.rustcc]' >> ~/.cargo/config && \
  121. echo 'registry = "https://code.aliyun.com/rustcc/crates.io-index.git"' >> ~/.cargo/config
  122. # RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain stable && \
  123. # cargo install cargo-binutils && \
  124. # rustup component add llvm-tools-preview && \
  125. # rustup component add rust-src
  126. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup.sh &&\
  127. sh rustup.sh -y --profile minimal &&\
  128. PATH=$PATH:/root/.cargo/bin &&\
  129. rustup target add riscv32i-unknown-none-elf &&\
  130. rustup component add llvm-tools-preview