Dockerfile-Allinone-flutter 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. FROM ubuntu:24.04 as builder
  2. USER root
  3. # apt change to aliyun
  4. RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list.d/ubuntu.sources
  5. RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list.d/ubuntu.sources
  6. RUN apt-get update && apt-get install -y \
  7. curl zip unzip wget git vim build-essential
  8. # install vnc gui
  9. RUN apt update && apt install -y xfce4 tightvncserver
  10. #CMD ["vncserver", ":1"]
  11. # install java
  12. RUN curl -s "https://get.sdkman.io" | bash
  13. RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 17.0.11-ms"
  14. ENV JAVA_HOME /root/.sdkman/candidates/java/17.0.11-ms
  15. ENV PATH=$PATH:$JAVA_HOME/bin
  16. ENV MAVEN_VERSION=3.9.5 \
  17. GRADLE_VERSION=7.5
  18. # install gradle
  19. RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp
  20. RUN unzip -d /opt/gradle /tmp/gradle-*.zip && rm -rf /tmp/gradle-*.zip
  21. ENV GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}
  22. ENV PATH=$PATH:$GRADLE_HOME/bin
  23. # install maven
  24. RUN wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.zip -P /tmp
  25. RUN unzip -d /opt/maven /tmp/apache-maven-*.zip
  26. ENV MAVEN_HOME=/opt/maven/apache-maven-${MAVEN_VERSION}
  27. ENV PATH=$PATH:$MAVEN_HOME/bin
  28. # install android sdk
  29. ENV ANDROID_HOME=/opt/androidsdk \
  30. FLUTTER_HOME=/opt/flutter
  31. RUN wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \
  32. && mkdir -p $ANDROID_HOME/cmdline-tools/latest \
  33. && unzip commandlinetools-linux-*.zip -d $ANDROID_HOME \
  34. && rm -f commandlinetools-linux-*.zip \
  35. && mv $ANDROID_HOME/cmdline-tools/bin $ANDROID_HOME/cmdline-tools/latest \
  36. && mv $ANDROID_HOME/cmdline-tools/lib $ANDROID_HOME/cmdline-tools/latest
  37. RUN echo "export ANDROID_HOME=$ANDROID_HOME" >> ~/.bashrc \
  38. && echo 'export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools:$PATH' >> ~/.bashrc
  39. ENV PATH=$PATH:$FLUTTER_HOME/bin:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/emulator
  40. RUN yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --verbose "platform-tools" "platforms;android-33"
  41. ENV PUB_HOSTED_URL=https://pub.flutter-io.cn
  42. ENV FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  43. # install flutter
  44. ARG FLUTTER_VERSION="3.13.5"
  45. RUN git clone --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME} \
  46. && cd ${FLUTTER_HOME} \
  47. && ./bin/flutter precache \
  48. && ./bin/flutter doctor
  49. RUN curl -fsSL https://fvm.app/install.sh | bash
  50. # install python
  51. RUN mkdir -p ~/.pip
  52. RUN echo '\n\
  53. [global] \n\
  54. trusted-host=mirrors.aliyun.com \n\
  55. index-url=https://mirrors.aliyun.com/pypi/simple/ \n\
  56. ' > ~/.pip/pip.conf
  57. ARG PYTHON_MAJ_VERSION=3.12
  58. ARG PYTHON_PATCH_VERSION=1
  59. ARG PYTHON_VERSION=${PYTHON_MAJ_VERSION}.${PYTHON_PATCH_VERSION}
  60. RUN apt-get update && \
  61. apt-get install -y \
  62. make \
  63. build-essential \
  64. libssl-dev \
  65. zlib1g-dev \
  66. libbz2-dev \
  67. libreadline-dev \
  68. libsqlite3-dev \
  69. curl \
  70. llvm \
  71. libncurses5-dev \
  72. libncursesw5-dev \
  73. xz-utils \
  74. tk-dev python3-dev default-libmysqlclient-dev libpq-dev
  75. RUN curl -O https://mirrors.huaweicloud.com/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz && \
  76. tar xzf Python-${PYTHON_VERSION}.tgz && \
  77. rm Python-${PYTHON_VERSION}.tgz && \
  78. cd Python-${PYTHON_VERSION} && \
  79. ./configure --prefix=/opt/python/${PYTHON_VERSION}/ --enable-optimizations --with-lto --with-computed-gotos --with-system-ffi && \
  80. make -j "$(nproc)" && \
  81. make altinstall
  82. RUN /opt/python/${PYTHON_VERSION}/bin/python${PYTHON_MAJ_VERSION} -m pip install --upgrade pip setuptools wheel poetry && \
  83. ln -s /opt/python/${PYTHON_VERSION}/bin/python${PYTHON_MAJ_VERSION} /opt/python/${PYTHON_VERSION}/bin/python3 && \
  84. ln -s /opt/python/${PYTHON_VERSION}/bin/python${PYTHON_MAJ_VERSION} /opt/python/${PYTHON_VERSION}/bin/python && \
  85. ln -s /opt/python/${PYTHON_VERSION}/bin/pydoc${PYTHON_MAJ_VERSION} /opt/python/${PYTHON_VERSION}/bin/pydoc && \
  86. ln -s /opt/python/${PYTHON_VERSION}/bin/idle${PYTHON_MAJ_VERSION} /opt/python/${PYTHON_VERSION}/bin/idle && \
  87. ln -s /opt/python/${PYTHON_VERSION}/bin/python${PYTHON_MAJ_VERSION}-config /opt/python/${PYTHON_VERSION}/bin/python-config
  88. ENV PATH=/opt/python/${PYTHON_VERSION}/bin:${PATH}
  89. RUN git clone --depth 1 https://github.com/pyenv/pyenv.git ~/.pyenv && \
  90. echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc && \
  91. echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc && \
  92. echo 'eval "$(pyenv init -)"' >> ~/.bashrc
  93. ENV PATH=$PATH:/root/.pyenv/bin
  94. ENV PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1
  95. ENV PYTHON_BUILD_MIRROR_URL=https://mirrors.huaweicloud.com/python/
  96. # RUN pyenv install ${PYTHON_VERSION} && pyenv global ${PYTHON_VERSION}
  97. RUN pip install jupyter jupyterlab jupyter_contrib_nbextensions
  98. # install R
  99. RUN apt-get update && apt-get install -y \
  100. r-base r-base-dev
  101. # install ruby
  102. RUN apt-get update && apt-get install -y \
  103. ruby-full rubygems ruby-dev
  104. # install rust
  105. ENV RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
  106. ENV RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
  107. ENV RUSTUP_DIST_ROOT=https://mirrors.ustc.edu.cn/rust-static
  108. RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  109. ENV PATH="$HOME/.cargo/bin:$PATH"
  110. # # install .net core 6.0
  111. # RUN wget http://ftp.us.debian.org/debian/pool/main/i/icu/libicu67_67.1-1_amd64.deb && \
  112. # dpkg -i libicu67_67.1-1_amd64.deb
  113. # RUN wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
  114. # dpkg -i packages-microsoft-prod.deb && \
  115. # rm packages-microsoft-prod.deb && \
  116. # apt-get update && \
  117. # apt-get install -y apt-transport-https && \
  118. # apt-get update && \
  119. # apt-get install -y dotnet-sdk-6.0 dotnet-runtime-deps-6.0
  120. # install go1.21
  121. RUN wget https://go.dev/dl/go1.21.4.linux-amd64.tar.gz && \
  122. tar -C /usr/local -xzf go1.21.4.linux-amd64.tar.gz && \
  123. rm go1.21.4.linux-amd64.tar.gz
  124. ENV PATH=$PATH:/usr/local/go/bin
  125. ENV GOPROXY="https://goproxy.io,direct"
  126. # install nodejs20
  127. RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
  128. RUN apt-get install -y nodejs
  129. RUN echo '\n\
  130. registry=http://registry.npm.taobao.org \n\
  131. sass_binary_site=https://npmmirror.com/mirrors/node-sass/ \n\
  132. electron_mirror=https://npmmirror.com/mirrors/electron/ \n\
  133. ELECTRON_BUILDER_BINARIES_MIRROR=https://npmmirror.com/mirrors/electron-builder-binaries/ \n\
  134. ' > ~/.npmrc
  135. RUN npm install -g yarn pnpm serve
  136. LABEL email="liuyuqi<liuyuqi.gov@msn.cn>"
  137. WORKDIR /workspaces
  138. RUN apt-get install -y openssh-server
  139. RUN apt-get clean && \
  140. rm -rf /var/lib/apt/lists/*
  141. # 指定字符集支持命令行输入中文(根据需要选择字符集)
  142. ENV LANG C.UTF-8
  143. ENV LANGUAGE C.UTF-8
  144. # set path
  145. RUN echo '\n\
  146. export JAVA_HOME=/root/.sdkman/candidates/java/17.0.11-ms \n\
  147. export PATH=$PATH:$JAVA_HOME/bin \n\
  148. export GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION} \n\
  149. export PATH=$PATH:$GRADLE_HOME/bin \n\
  150. export MAVEN_HOME=/opt/maven/apache-maven-${MAVEN_VERSION} \n\
  151. export PATH=$PATH:$MAVEN_HOME/bin \n\
  152. export FLUTTER_HOME=/opt/flutter \n\
  153. export PUB_HOSTED_URL=https://pub.flutter-io.cn \n\
  154. export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn \n\
  155. export PATH=$PATH:$FLUTTER_HOME/bin \n\
  156. export PATH=$PATH:/opt/python/${PYTHON_VERSION}/bin \n\
  157. export PYTHON_BUILD_MIRROR_URL_SKIP_CHECKSUM=1 \n\
  158. export PYTHON_BUILD_MIRROR_URL=https://mirrors.huaweicloud.com/python/ \n\
  159. export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static \n\
  160. export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup \n\
  161. export RUSTUP_DIST_ROOT=https://mirrors.ustc.edu.cn/rust-static \n\
  162. export PATH=$PATH:/usr/local/go/bin \n\
  163. export GOPROXY="https://goproxy.io,direct" \n\
  164. ' >> ~/.bashrc
  165. # install vscode and extension
  166. RUN curl -fsSL https://code-server.dev/install.sh | sh &&\
  167. code-server --install-extension redhat.vscode-yaml &&\
  168. code-server --install-extension orta.vscode-jest &&\
  169. code-server --install-extension dbaeumer.vscode-eslint &&\
  170. code-server --install-extension ms-python.python &&\
  171. code-server --install-extension ms-azuretools.vscode-docker &&\
  172. code-server --install-extension mhutchie.git-graph &&\
  173. code-server --install-extension ardisaurus.gitflow-actions-sidebar &&\
  174. code-server --install-extension Dart-Code.flutter &&\
  175. code-server --install-extension golang.go &&\
  176. code-server --install-extension Vue.volar &&\
  177. code-server --install-extension eamodio.gitlens &&\
  178. code-server --install-extension REditorSupport.r &&\
  179. code-server --install-extension vscjava.vscode-java-pack &&\
  180. code-server --install-extension vscjava.vscode-java-debug &&\
  181. code-server --install-extension vscjava.vscode-java-dependency &&\
  182. code-server --install-extension vscjava.vscode-maven &&\
  183. code-server --install-extension vscjava.vscode-spring-initializr &&\
  184. echo done
  185. # install manual
  186. # docker run -it --rm -v /workspace:/workspaces sift-docker.pkg.coding.net/flutter-team/dev-container/dev-allinone:1.0.12-flutter /bin/bash
  187. RUN code-server --install-extension ms-python.vscode-pylance-2024.6.103.vsix
  188. # code-server --install-extension ms-dotnettools.csharp &&\
  189. COPY ./frp /opt/frp
  190. VOLUME [ "/workspaces" ]
  191. CMD [ "/bin/bash" ]