Dockerfile 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. FROM ubuntu:focal
  2. LABEL maintainer="Jeremy Zheng"
  3. ENV DEBIAN_FRONTEND noninteractive
  4. RUN apt update
  5. RUN apt install -y lsb-release
  6. RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" > /etc/apt/sources.list
  7. RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
  8. RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
  9. RUN dpkg --add-architecture arm64
  10. RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" >> /etc/apt/sources.list
  11. RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
  12. RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
  13. RUN apt update && apt -y upgrade
  14. ENV GCC_VERSION 10
  15. ENV CLANG_VERSION 12
  16. RUN apt -y install zsh git locales locales-all \
  17. vim tzdata zip unzip tree tmux \
  18. build-essential crossbuild-essential-arm64 \
  19. g++-${GCC_VERSION} g++-${GCC_VERSION}-aarch64-linux-gnu \
  20. libstdc++-${GCC_VERSION}-dev:amd64 libstdc++-${GCC_VERSION}-dev:arm64 \
  21. clang-${CLANG_VERSION} lldb-${CLANG_VERSION} lld-${CLANG_VERSION} \
  22. cmake pkg-config libtool automake autoconf autoconf-archive binutils cpio \
  23. debhelper bison flex ninja-build \
  24. python3 python3-distutils python3-dev python3-pip virtualenv
  25. RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100 \
  26. && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100 \
  27. && update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${CLANG_VERSION} 100 \
  28. && update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${CLANG_VERSION} 100 \
  29. && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
  30. && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 \
  31. && update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-${GCC_VERSION} 100 \
  32. && update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-${GCC_VERSION} 100
  33. RUN apt -y autoremove && apt -y clean
  34. RUN cd /usr/bin && ln -s make gmake
  35. RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
  36. RUN locale-gen
  37. RUN update-locale LANG=en_US.UTF-8
  38. RUN update-alternatives --set editor /usr/bin/vim.basic
  39. RUN mkdir -p $HOME/downloads $HOME/build $HOME/local $HOME/tmp
  40. # https://github.com/ohmyzsh/ohmyzsh
  41. RUN git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
  42. RUN cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
  43. RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.zshrc
  44. RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.zshrc
  45. RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.zshrc
  46. RUN git config --global core.quotepath false \
  47. && git config --global http.version HTTP/1.1 \
  48. && git config --global pull.rebase false \
  49. && git config --global url."https://".insteadOf git://
  50. RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf \
  51. && echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
  52. # https://github.com/nvm-sh/nvm
  53. ENV NVM_VERSION "v0.39.3"
  54. RUN git clone -b ${NVM_VERSION} https://github.com/nvm-sh/nvm.git $HOME/.nvm
  55. RUN echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.zshrc
  56. RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $HOME/.zshrc
  57. RUN echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> $HOME/.zshrc
  58. RUN zsh -c "source $HOME/.zshrc \
  59. && nvm install node \
  60. && nvm use node \
  61. && npm i yarn -g"
  62. RUN echo 'export PATH=$HOME/.yarn/bin:$PATH' >> $HOME/.zshrc
  63. # https://www.rust-lang.org/tools/install
  64. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  65. RUN zsh -c "source $HOME/.cargo/env && rustup target add aarch64-unknown-linux-gnu"
  66. # https://github.com/rui314/mold
  67. RUN git clone -b v1.9.0 https://github.com/rui314/mold.git $HOME/downloads/mold
  68. RUN apt install -y g++-10 \
  69. libssl-dev libxxhash-dev zlib1g-dev \
  70. file bsdmainutils
  71. RUN zsh -c "source $HOME/.zshrc \
  72. && mkdir $HOME/build/mold \
  73. && cd $HOME/build/mold \
  74. && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-10 \
  75. -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/mold \
  76. && make -j \
  77. && make install"
  78. RUN cp $HOME/.local/bin/mold /usr/bin/
  79. # https://github.com/grpc/grpc
  80. ENV GRPC_VERSION "v1.51.1"
  81. RUN git clone --recurse-submodules -b $GRPC_VERSION https://github.com/grpc/grpc.git $HOME/downloads/grpc
  82. RUN zsh -c "source $HOME/.zshrc \
  83. && mkdir -pv $HOME/build/grpc \
  84. && cd $HOME/build/grpc \
  85. && cmake -DCMAKE_BUILD_TYPE=Release \
  86. -DgRPC_INSTALL=ON \
  87. -DgRPC_SSL_PROVIDER=package \
  88. -DgRPC_BUILD_TESTS=OFF \
  89. -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/grpc \
  90. && make -j \
  91. && make install"
  92. RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
  93. VOLUME /workspace
  94. WORKDIR /workspace
  95. CMD ["/bin/zsh", "-l"]