Dockerfile-Allinone-flutter 10 KB

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