Dockerfile-Allinone-flutter 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. FROM openjdk:11 as builder
  2. ENV MAVEN_VERSION=3.9.5 \
  3. GRADLE_VERSION=7.5
  4. ARG FLUTTER_VERSION="3.13.5"
  5. RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  6. RUN sed -i s@/security.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  7. RUN apt-get update && apt-get install -y \
  8. curl unzip wget git vim
  9. RUN apt install build-essential -y
  10. # install java 21.0.1-ms
  11. RUN curl -s "https://get.sdkman.io" | bash
  12. RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk install java 21.0.1-ms"
  13. ENV JAVA_HOME /root/.sdkman/candidates/java/21.0.1-ms
  14. # install gradle
  15. RUN wget https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp
  16. RUN unzip -d /opt/gradle /tmp/gradle-*.zip && rm -rf /tmp/gradle-*.zip
  17. ENV GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}
  18. ENV PATH=$PATH:$GRADLE_HOME/bin
  19. # install maven
  20. RUN wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.zip -P /tmp
  21. RUN unzip -d /opt/maven /tmp/apache-maven-*.zip
  22. ENV MAVEN_HOME=/opt/maven/apache-maven-${MAVEN_VERSION}
  23. ENV PATH=$PATH:$MAVEN_HOME/bin
  24. # install android sdk
  25. ENV ANDROID_HOME=/opt/androidsdk \
  26. FLUTTER_HOME=/opt/flutter
  27. RUN wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip \
  28. && mkdir -p $ANDROID_HOME/cmdline-tools/latest \
  29. && unzip commandlinetools-linux-*.zip -d $ANDROID_HOME \
  30. && rm -f commandlinetools-linux-*.zip \
  31. && mv $ANDROID_HOME/cmdline-tools/bin $ANDROID_HOME/cmdline-tools/latest \
  32. && mv $ANDROID_HOME/cmdline-tools/lib $ANDROID_HOME/cmdline-tools/latest
  33. RUN echo "export ANDROID_HOME=$ANDROID_HOME" >> ~/.bashrc \
  34. && echo 'export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools:$PATH' >> ~/.bashrc
  35. 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
  36. RUN yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --verbose "platform-tools" "platforms;android-33"
  37. ENV PUB_HOSTED_URL=https://pub.flutter-io.cn
  38. ENV FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  39. # install flutter
  40. RUN git clone --branch ${FLUTTER_VERSION} https://github.com/flutter/flutter.git ${FLUTTER_HOME} \
  41. && cd ${FLUTTER_HOME} \
  42. && ./bin/flutter precache \
  43. && ./bin/flutter doctor
  44. # install python 3.10
  45. RUN mkdir -p ~/.pip
  46. RUN echo '\n\
  47. [global] \n\
  48. trusted-host=mirrors.aliyun.com \n\
  49. index-url=https://mirrors.aliyun.com/pypi/simple/ \n\
  50. ' > ~/.pip/pip.conf
  51. # RUN apt-get update && apt-get install -y \
  52. # software-properties-common
  53. # RUN add-apt-repository -y ppa:deadsnakes/ppa
  54. # RUN apt-get update && \
  55. # apt-get install -y python3.10 python3.10-distutils
  56. RUN apt update && apt install -y python3-distutils
  57. RUN curl http://fileshare.yoqi.me/d/DevFiles/Develop/Python/get-pip.py?sign=17C5fjx9l5VpBJ6FCHonje5nEEkylSINsPlKsASVkRc=:1702263152 -o get-pip.py && \
  58. python3 get-pip.py && \
  59. rm get-pip.py
  60. RUN ln -s /usr/bin/python3.9 /usr/bin/python && \
  61. ln -s /usr/bin/pip3 /usr/bin/pip
  62. # install R
  63. RUN apt-get update && apt-get install -y \
  64. r-base r-base-dev
  65. # install ruby
  66. # RUN apt-get update && apt-get install -y \
  67. # ruby-full rubygems ruby-dev
  68. # install rust
  69. # RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
  70. # install .net core 6.0
  71. # RUN wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \
  72. # dpkg -i packages-microsoft-prod.deb && \
  73. # rm packages-microsoft-prod.deb && \
  74. # apt-get update && \
  75. # apt-get install -y apt-transport-https && \
  76. # apt-get update && \
  77. # apt-get install -y dotnet-sdk-6.0
  78. # install go1.21
  79. RUN wget https://go.dev/dl/go1.21.4.linux-amd64.tar.gz && \
  80. tar -C /usr/local -xzf go1.21.4.linux-amd64.tar.gz
  81. ENV PATH=$PATH:/usr/local/go/bin
  82. RUN export GOPROXY="https://goproxy.io,direct"
  83. # install nodejs20
  84. RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
  85. RUN apt-get install -y nodejs
  86. RUN npm config set registry http://registry.npm.taobao.org --global
  87. RUN npm config set ELECTRON_MIRROR https://npmmirror.com/mirrors/electron/ --global
  88. RUN npm config set ELECTRON_BUILDER_BINARIES_MIRROR https://npmmirror.com/mirrors/electron-builder-binaries/ --global
  89. RUN npm install -g yarn pnpm
  90. RUN rm -rf /var/lib/apt/lists/*
  91. LABEL email="liuyuqi<liuyuqi.gov@msn.cn>"
  92. WORKDIR /workspaces
  93. RUN apt-get install -y openssh-server
  94. # 指定字符集支持命令行输入中文(根据需要选择字符集)
  95. ENV LANG C.UTF-8
  96. ENV LANGUAGE C.UTF-8
  97. # set path
  98. RUN echo '\n\
  99. export PATH=$PATH:$GRADLE_HOME/bin \n\
  100. export JAVA_HOME=/usr/local/openjdk-11 \n\
  101. export PATH=$PATH:$JAVA_HOME/bin \n\
  102. export PATH=$PATH:$MAVEN_HOME/bin \n\
  103. export PATH=$PATH:/usr/local/go/bin \n\
  104. export GOPROXY="https://goproxy.io,direct" \n\
  105. ' >> ~/.bashrc
  106. # install vscode and extension
  107. RUN curl -fsSL https://code-server.dev/install.sh | sh &&\
  108. code-server --install-extension redhat.vscode-yaml &&\
  109. code-server --install-extension orta.vscode-jest &&\
  110. code-server --install-extension dbaeumer.vscode-eslint &&\
  111. code-server --install-extension ms-python.python &&\
  112. code-server --install-extension ms-python.vscode-pylance &&\
  113. code-server --install-extension ms-azuretools.vscode-docker &&\
  114. code-server --install-extension mhutchie.git-graph &&\
  115. code-server --install-extension ardisaurus.gitflow-actions-sidebar &&\
  116. code-server --install-extension Dart-Code.flutter &&\
  117. code-server --install-extension golang.go &&\
  118. code-server --install-extension Vue.volar &&\
  119. code-server --install-extension eamodio.gitlens &&\
  120. code-server --install-extension REditorSupport.r &&\
  121. echo done
  122. # code-server --install-extension ms-dotnettools.csharp &&\
  123. VOLUME [ "/workspaces" ]
  124. CMD [ "/bin/bash" ]