فهرست منبع

:hammer: upgrade to 2023.01

Jeremy Zheng 3 سال پیش
والد
کامیت
191fad25b9
40فایلهای تغییر یافته به همراه592 افزوده شده و 263 حذف شده
  1. 22 0
      docker/README.md
  2. 2 7
      docker/alpine/start.sh
  3. 110 0
      docker/focal/Dockerfile
  4. 16 0
      docker/focal/build.sh
  5. 11 0
      docker/focal/start.sh
  6. 21 248
      docker/jammy/Dockerfile
  7. 1 1
      docker/jammy/build.sh
  8. 2 7
      docker/jammy/start.sh
  9. 316 0
      docker/spring/Dockerfile
  10. 63 0
      docker/spring/README.md
  11. 16 0
      docker/spring/build.sh
  12. 0 0
      docker/spring/conan/conanfile.txt
  13. 0 0
      docker/spring/conan/install.sh
  14. 0 0
      docker/spring/conan/profiles/amd64
  15. 0 0
      docker/spring/conan/profiles/arm64
  16. 0 0
      docker/spring/conan/profiles/armhf
  17. 0 0
      docker/spring/conan/toolchains/amd64.cmake
  18. 0 0
      docker/spring/conan/toolchains/arm64.cmake
  19. 0 0
      docker/spring/conan/toolchains/armhf.cmake
  20. 0 0
      docker/spring/etc/envoy.yaml
  21. 1 0
      docker/spring/etc/nginx.conf
  22. 0 0
      docker/spring/etc/redis/clusters-init.sh
  23. 0 0
      docker/spring/etc/redis/node-1.conf
  24. 0 0
      docker/spring/etc/redis/node-2.conf
  25. 0 0
      docker/spring/etc/redis/node-3.conf
  26. 0 0
      docker/spring/etc/redis/node-4.conf
  27. 0 0
      docker/spring/etc/redis/node-5.conf
  28. 0 0
      docker/spring/etc/redis/node-6.conf
  29. 0 0
      docker/spring/etc/redis/node-s.conf
  30. 0 0
      docker/spring/etc/supervisor/conf.d/envoy.conf
  31. 0 0
      docker/spring/etc/supervisor/conf.d/minio.conf
  32. 0 0
      docker/spring/etc/supervisor/conf.d/mysql.conf
  33. 0 0
      docker/spring/etc/supervisor/conf.d/nginx.conf
  34. 0 0
      docker/spring/etc/supervisor/conf.d/opensearch.conf
  35. 0 0
      docker/spring/etc/supervisor/conf.d/php-fpm.conf
  36. 0 0
      docker/spring/etc/supervisor/conf.d/postgresql.conf
  37. 0 0
      docker/spring/etc/supervisor/conf.d/rabbitmq.conf
  38. 0 0
      docker/spring/etc/supervisor/conf.d/redis.conf
  39. 0 0
      docker/spring/etc/supervisor/supervisord.conf
  40. 11 0
      docker/spring/start.sh

+ 22 - 0
docker/README.md

@@ -0,0 +1,22 @@
+# Usage
+
+```bash
+sudo apt install crun podman buildah
+```
+
+- commands
+
+  ```bash
+  podman image prune # removes all dangling images
+  podman system reset # clean
+  podman images # show images
+  podman ps -a # show containers
+  podman load -i tmp/palm-CODE-TIMESTAMP.tar # import image
+  ```
+
+- Envoy build
+
+  ```bash
+  podman pull docker.io/envoyproxy/envoy-dev:latest
+  podman run --rm -it docker.io/envoyproxy/envoy-dev:latest
+  ```

+ 2 - 7
docker/alpine/start.sh

@@ -6,11 +6,6 @@ export NAME="$CODE-$USER"
 if podman container exists $NAME
 then
     podman start -i -a $NAME
-else
-    if [ "$(uname)" == "Darwin" ]
-    then
-        podman run --name $NAME -it --hostname=palm --network host -v $PWD:/workspace:z $CODE
-    else
-        podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
-    fi
+else    
+    podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
 fi

+ 110 - 0
docker/focal/Dockerfile

@@ -0,0 +1,110 @@
+FROM ubuntu:focal
+LABEL maintainer="Jeremy Zheng"
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt update
+RUN apt install -y lsb-release
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" > /etc/apt/sources.list
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN dpkg --add-architecture arm64
+RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN apt update && apt -y upgrade
+
+ENV GCC_VERSION 10
+ENV CLANG_VERSION 12
+RUN apt -y install zsh git locales locales-all \
+    vim tzdata zip unzip tree tmux \
+    build-essential crossbuild-essential-arm64 \
+    g++-${GCC_VERSION} g++-${GCC_VERSION}-aarch64-linux-gnu \
+    libstdc++-${GCC_VERSION}-dev:amd64 libstdc++-${GCC_VERSION}-dev:arm64 \
+    clang-${CLANG_VERSION} lldb-${CLANG_VERSION} lld-${CLANG_VERSION} \
+    cmake pkg-config libtool automake autoconf autoconf-archive binutils cpio \
+    debhelper bison flex ninja-build \
+    python3 python3-distutils python3-dev python3-pip virtualenv
+RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-${GCC_VERSION} 100
+
+RUN apt -y autoremove && apt -y clean
+
+RUN cd /usr/bin && ln -s make gmake
+RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
+RUN locale-gen
+RUN update-locale LANG=en_US.UTF-8
+RUN update-alternatives --set editor /usr/bin/vim.basic
+
+RUN mkdir -p $HOME/downloads $HOME/build $HOME/local $HOME/tmp
+
+# https://github.com/ohmyzsh/ohmyzsh
+RUN git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
+RUN cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
+RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.zshrc
+RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.zshrc
+RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.zshrc
+
+RUN git config --global core.quotepath false \
+    && git config --global http.version HTTP/1.1 \
+    && git config --global pull.rebase false \
+    && git config --global url."https://".insteadOf git://
+RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf \
+    && echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
+
+# https://github.com/nvm-sh/nvm
+ENV NVM_VERSION "v0.39.3"
+RUN git clone -b ${NVM_VERSION} https://github.com/nvm-sh/nvm.git $HOME/.nvm
+RUN echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.zshrc
+RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $HOME/.zshrc
+RUN echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> $HOME/.zshrc
+RUN zsh -c "source $HOME/.zshrc \
+    && nvm install node \
+    && nvm use node \
+    && npm i yarn -g"
+RUN echo 'export PATH=$HOME/.yarn/bin:$PATH' >> $HOME/.zshrc
+
+# https://www.rust-lang.org/tools/install
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+RUN zsh -c "source $HOME/.cargo/env && rustup target add aarch64-unknown-linux-gnu"
+
+# https://github.com/rui314/mold
+RUN git clone -b v1.9.0 https://github.com/rui314/mold.git $HOME/downloads/mold
+RUN apt install -y g++-10 \
+    libssl-dev libxxhash-dev zlib1g-dev \
+    file bsdmainutils
+RUN zsh -c "source $HOME/.zshrc \
+    && mkdir $HOME/build/mold \
+    && cd $HOME/build/mold \
+    && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++-10 \
+        -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/mold \
+    && make -j \
+    && make install"
+RUN cp $HOME/.local/bin/mold /usr/bin/
+
+# https://github.com/grpc/grpc
+ENV GRPC_VERSION "v1.51.1"
+RUN git clone --recurse-submodules -b $GRPC_VERSION https://github.com/grpc/grpc.git $HOME/downloads/grpc
+RUN zsh -c "source $HOME/.zshrc \
+    && mkdir -pv $HOME/build/grpc \
+    && cd $HOME/build/grpc \
+    && cmake -DCMAKE_BUILD_TYPE=Release \
+        -DgRPC_INSTALL=ON \
+        -DgRPC_SSL_PROVIDER=package \
+        -DgRPC_BUILD_TESTS=OFF \
+        -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/grpc \
+    && make -j \
+    && make install"
+
+RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
+
+VOLUME /workspace
+WORKDIR /workspace
+
+CMD ["/bin/zsh", "-l"]

+ 16 - 0
docker/focal/build.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+export VERSION=$(date "+%4Y%m%d%H%M%S")
+export CODE="palm-focal"
+
+buildah pull ubuntu:focal
+buildah bud --layers -t $CODE .
+podman save -o $CODE-$VERSION.tar $CODE
+XZ_OPT=-9 tar -cJf $CODE-$VERSION.tar.xz $CODE-$VERSION.tar
+md5sum $CODE-$VERSION.tar* > md5.txt
+
+echo "done($CODE-$VERSION.tar.xz)."
+
+exit 0

+ 11 - 0
docker/focal/start.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+export CODE="palm-focal"
+export NAME="$CODE-$USER"
+
+if podman container exists $NAME
+then
+    podman start -i -a $NAME
+else    
+    podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
+fi

+ 21 - 248
docker/jammy/Dockerfile

@@ -4,68 +4,23 @@ LABEL maintainer="Jeremy Zheng"
 ENV DEBIAN_FRONTEND noninteractive
 
 RUN apt update
-RUN apt -y upgrade
-RUN apt -y install debian-keyring debian-archive-keyring apt-transport-https software-properties-common curl wget gnupg
-
-# https://wiki.ubuntu.com/ToolChain
+RUN apt install -y lsb-release
 RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" > /etc/apt/sources.list
 RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
 RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
-RUN dpkg --add-architecture armhf
 RUN dpkg --add-architecture arm64
-RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" >> /etc/apt/sources.list
-RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
-RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
 RUN apt update
 RUN apt -y upgrade
 
-RUN apt -y install zsh git locales locales-all rsync openssh-client sshpass \
-    vim tzdata pwgen zip unzip tree tmux dialog asciidoc doxygen \
-    net-tools dnsutils net-tools iputils-arping iputils-ping telnet \
-    imagemagick ffmpeg fonts-dejavu-extra texlive-full \
-    build-essential cmake pkg-config libtool automake autoconf autoconf-archive binutils cpio mold \
+RUN apt -y install zsh git locales locales-all \
+    vim tzdata zip unzip tree tmux \
+    build-essential crossbuild-essential-arm64 clang lldb lld mold \
+    cmake pkg-config libtool automake autoconf autoconf-archive binutils cpio \
     debhelper bison flex ninja-build \
-    musl-tools musl-dev \
-    crossbuild-essential-armhf crossbuild-essential-arm64 \
-    python3 python3-distutils python3-dev python3-pip virtualenv \
-    php-fpm php-mbstring php-json php-xml php-pear php-bcmath php-curl php-zip \
-    php-mysql php-pgsql php-sqlite3 php-redis php-mongodb php-amqp php-zmq \
-    php-imagick php-gd \
-    nginx rabbitmq-server redis postgresql mariadb-server
-
-# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
-RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
-RUN apt update
-ENV GCC_VERSION 12
-RUN apt install -y g++-${GCC_VERSION} g++-${GCC_VERSION}-aarch64-linux-gnu g++-${GCC_VERSION}-arm-linux-gnueabihf
-RUN apt install -y libstdc++-${GCC_VERSION}-dev:amd64 libstdc++-${GCC_VERSION}-dev:arm64 libstdc++-${GCC_VERSION}-dev:armhf
-
-# https://apt.llvm.org/
-ENV CLANG_VERSION=15
-RUN echo "deb [arch=amd64] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${CLANG_VERSION} main" > /etc/apt/sources.list.d/llvm.list
-RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
-RUN apt update
-RUN apt install -y clang-${CLANG_VERSION} \
-    clangd-${CLANG_VERSION} clang-tools-${CLANG_VERSION} clang-format-${CLANG_VERSION} \
-    lldb-${CLANG_VERSION} lld-${CLANG_VERSION}
-RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100
-RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100
-RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${CLANG_VERSION} 100
-RUN update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${CLANG_VERSION} 100
-RUN update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${CLANG_VERSION} 100
-
-# https://www.envoyproxy.io/docs/envoy/latest/start/install#install-envoy-on-ubuntu-linux
-RUN curl -sL 'https://deb.dl.getenvoy.io/public/gpg.8115BA8E629CC074.key' | gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg
-RUN echo a077cb587a1b622e03aa4bf2f3689de14658a9497a9af2c427bba5f4cc3c4723 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check
-RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://deb.dl.getenvoy.io/public/deb/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/getenvoy.list
-RUN apt update
-RUN apt install -y getenvoy-envoy
-
-# https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
-# RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
-# RUN echo "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
-# RUN apt update
-# RUN apt install -y mongodb
+    python3 python3-distutils python3-dev python3-pip virtualenv
 
 RUN apt -y autoremove
 RUN apt -y clean
@@ -84,97 +39,15 @@ RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.zshrc
 RUN echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.zshrc
 RUN echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.zshrc
 
-RUN git config --global core.quotepath false
-RUN git config --global http.version HTTP/1.1
-RUN git config --global pull.rebase false
-RUN git config --global url."https://".insteadOf git://
-RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf
-RUN echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
-
-RUN zsh -c "source $HOME/.zshrc && pip3 install --user cmake"
-RUN zsh -c "source $HOME/.zshrc \
-    && pip3 install --user ansible paramiko"
-RUN echo 'export ANSIBLE_HOST_KEY_CHECKING=False' >> $HOME/.zshrc
-RUN echo 'alias peony="ANSIBLE_LOG_PATH=$HOME/tmp/$(date +%Y%m%d%H%M%S).log ansible-playbook"' >> $HOME/.zshrc
-
-RUN zsh -c "source $HOME/.zshrc \
-    && pip3 install --user conan \
-    && conan profile new default --detect \
-    && conan profile update settings.compiler.libcxx=libstdc++11 default"
-
-RUN zsh -c "source $HOME/.zshrc && pip3 install --user supervisor"
-
-# https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
-RUN wget -q -O $HOME/downloads/composer https://getcomposer.org/installer
-RUN cd $HOME/downloads \
-    && php composer \
-    && mv composer.phar $HOME/.local/bin/composer
-
-# https://github.com/rui314/mold
-# RUN git clone -b v1.6.0 https://github.com/rui314/mold.git $HOME/downloads/mold
-# RUN apt install -y libssl-dev libxxhash-dev zlib1g-dev \
-#     file bsdmainutils
-# RUN zsh -c "source $HOME/.zshrc \
-#     && mkdir $HOME/build/mold \
-#     && cd $HOME/build/mold \
-#     && cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ $HOME/downloads/mold \
-#     && make -j \
-#     && make install "
-
-# https://github.com/richfelker/musl-cross-make
-RUN git clone https://github.com/richfelker/musl-cross-make.git $HOME/build/musl-cross-make
-RUN cd $HOME/build/musl-cross-make \
-    && echo "TARGET=x86_64-linux-musl" > config.mak \
-    && echo "OUTPUT=/opt/crosstools" >> config.mak \
-    && make \
-    && make install 
-RUN cd $HOME/build/musl-cross-make \
-    && echo "TARGET=aarch64-linux-musl" > config.mak \
-    && echo "OUTPUT=/opt/crosstools" >> config.mak \
-    && make \
-    && make install
-RUN cd $HOME/build/musl-cross-make \
-    && echo "TARGET=arm-linux-musleabihf" > config.mak \
-    && echo "OUTPUT=/opt/crosstools" >> config.mak \
-    && make \
-    && make install
-
-ENV BAZEL_VERSION "v1.15.0"
-RUN wget -q -O $HOME/.local/bin/bazel \
-    https://github.com/bazelbuild/bazelisk/releases/download/${BAZEL_VERSION}/bazelisk-linux-amd64
-RUN chmod +x $HOME/.local/bin/bazel
-
-# https://github.com/rbenv/rbenv
-RUN git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv
-RUN cd $HOME/.rbenv && src/configure && make -C src
-RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.zshrc
-RUN echo 'eval "$(rbenv init -)"' >> $HOME/.zshrc
-RUN git clone https://github.com/rbenv/ruby-build.git $HOME/.rbenv/plugins/ruby-build
-RUN git clone https://github.com/rbenv/rbenv-vars.git $HOME/.rbenv/plugins/rbenv-vars
-ENV RUBY_VERSION "3.1.2"
-RUN apt install -y libssl-dev
-RUN zsh -c "source $HOME/.zshrc \
-    && rbenv install ${RUBY_VERSION} \
-    && rbenv global ${RUBY_VERSION} \
-    && gem install bundler"
-
-ENV GO_VERSION "1.19.2"
-RUN wget -q -P $HOME/downloads https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
-RUN tar xf $HOME/downloads/go${GO_VERSION}.linux-amd64.tar.gz -C $HOME/local
-RUN echo 'export GOROOT=$HOME/local/go' >> $HOME/.zshrc
-RUN echo 'export PATH=$GOROOT/bin:$PATH' >> $HOME/.zshrc
-RUN echo 'export GOPATH=$HOME/go' >> $HOME/.zshrc
-
-ENV JDK_VERSION "19.0.1-open"
-RUN curl -s "https://get.sdkman.io" | zsh
-RUN sed -i -e 's/sdkman_auto_answer=false/sdkman_auto_answer=true/g' $HOME/.sdkman/etc/config
-RUN zsh -c "source $HOME/.zshrc \
-    && sdk install java ${JDK_VERSION} \
-    && sdk install maven \
-    && sdk install gradle"
+RUN git config --global core.quotepath false \
+    && git config --global http.version HTTP/1.1 \
+    && git config --global pull.rebase false \
+    && git config --global url."https://".insteadOf git://
+RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf \
+    && echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
 
 # https://github.com/nvm-sh/nvm
-ENV NVM_VERSION "v0.39.2"
+ENV NVM_VERSION "v0.39.3"
 RUN git clone -b ${NVM_VERSION} https://github.com/nvm-sh/nvm.git $HOME/.nvm
 RUN echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.zshrc
 RUN echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $HOME/.zshrc
@@ -183,47 +56,17 @@ RUN zsh -c "source $HOME/.zshrc \
     && nvm install node \
     && nvm use node \
     && npm i yarn -g"
-RUN zsh -c "source $HOME/.zshrc \
-    && nvm install --lts \
-    && nvm use --lts \
-    && npm i yarn -g"
-# https://stackoverflow.com/questions/37324519/node-sass-does-not-yet-support-your-current-environment-linux-64-bit-with-false
-RUN zsh -c "source $HOME/.zshrc \
-    && nvm install lts/fermium \
-    && nvm use lts/fermium \
-    && npm i yarn -g"
 RUN echo 'export PATH=$HOME/.yarn/bin:$PATH' >> $HOME/.zshrc
 
 # https://www.rust-lang.org/tools/install
 RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
-# https://doc.rust-lang.org/nightly/rustc/platform-support.html
-RUN zsh -c "source $HOME/.cargo/env \
-    && rustup component add rust-analyzer \
-    && rustup target add armv7-unknown-linux-gnueabihf \
-    && rustup target add aarch64-unknown-linux-gnu \
-    && rustup target add x86_64-unknown-linux-musl \
-    && rustup target add aarch64-unknown-linux-musl"
-
-
-RUN apt install -y libpq-dev libmysqlclient-dev libsqlite3-dev
-RUN zsh -c "source $HOME/.zshrc \
-    && cargo install diesel_cli \
-    && cargo install --locked cargo-outdated \
-    && cargo install mdbook"
+RUN zsh -c "source $HOME/.cargo/env && rustup target add aarch64-unknown-linux-gnu"
 
-# https://opensearch.org/downloads.html#opensearch
-ENV OPENSEARCH_VERSION "2.3.0"
-RUN wget -q -P $HOME/downloads \
-    https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION}/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz
-RUN tar xf $HOME/downloads/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz -C /opt
 
-# https://min.io/download#/linux
-RUN wget -q -O /usr/bin/minio \
-    https://dl.min.io/server/minio/release/linux-amd64/minio
-RUN chmod +x /usr/bin/minio
-
-ENV GRPC_VERSION "v1.50.1"
+# https://github.com/grpc/grpc
+ENV GRPC_VERSION "v1.51.1"
 RUN git clone --recurse-submodules -b $GRPC_VERSION https://github.com/grpc/grpc.git $HOME/downloads/grpc
+RUN apt install -y libssl-dev
 RUN zsh -c "source $HOME/.zshrc \
     && mkdir -pv $HOME/build/grpc \
     && cd $HOME/build/grpc \
@@ -234,77 +77,7 @@ RUN zsh -c "source $HOME/.zshrc \
         -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/grpc \
     && make -j \
     && make install"
-
-# https://github.com/grpc/grpc-web#code-generator-plugin
-ENV GRPC_WEB_PLUGIN_VERSION "1.4.2"
-RUN wget -q -O $HOME/.local/bin/protoc-gen-grpc-web \
-    https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_PLUGIN_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_PLUGIN_VERSION}-linux-x86_64
-RUN chmod +x $HOME/.local/bin/protoc-gen-grpc-web
-
-# https://github.com/protocolbuffers/protobuf-javascript
-ENV GRPC_JS_PLUGIN_VERSION "3.21.2"
-RUN wget -q -P $HOME/downloads \
-    https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${GRPC_JS_PLUGIN_VERSION}/protobuf-javascript-${GRPC_JS_PLUGIN_VERSION}-linux-x86_64.tar.gz
-RUN mkdir -p $HOME/build/protobuf-javascript \
-    && cd $HOME/build/protobuf-javascript \
-    && tar xf $HOME/downloads/protobuf-javascript-${GRPC_JS_PLUGIN_VERSION}-linux-x86_64.tar.gz \
-    && cp bin/protoc-gen-js $HOME/.local/bin/
-
-# https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/
-ENV GRPC_JAVA_PLUGIN_VERSION "1.50.2"
-RUN wget -q -O $HOME/.local/bin/grpc_java_plugin \
-    https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${GRPC_JAVA_PLUGIN_VERSION}/protoc-gen-grpc-java-${GRPC_JAVA_PLUGIN_VERSION}-linux-x86_64.exe
-RUN chmod +x $HOME/.local/bin/grpc_java_plugin
-
-ENV FLATBUFFERS_VERSION "v22.10.26"
-RUN git clone -b $FLATBUFFERS_VERSION https://github.com/google/flatbuffers.git $HOME/downloads/flatbuffers
-RUN zsh -c "source $HOME/.zshrc \
-    && mkdir -pv $HOME/build/flatbuffers \
-    && cd $HOME/build/flatbuffers \
-    && cmake -DCMAKE_BUILD_TYPE=Release \
-        -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/flatbuffers \
-    && make -j \
-    && make install"
-
-RUN git clone https://github.com/microsoft/vcpkg.git $HOME/local/vcpkg
-RUN $HOME/local/vcpkg/bootstrap-vcpkg.sh
-RUN echo 'export VCPKG_DISABLE_METRICS=1' >> $HOME/.zshrc
-
-ADD conan /opt/conan
-# RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh amd64"
-# RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh arm64"
-# RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh armhf"
-
-# https://opensearch.org/docs/latest/opensearch/install/tar/
-RUN echo "network.host: 0.0.0.0" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
-RUN echo "discovery.type: single-node" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
-RUN echo "plugins.security.disabled: true" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml
-RUN chown -R nobody /opt/opensearch-${OPENSEARCH_VERSION}
-
-RUN mkdir -p /var/lib/minio/data
-RUN chown -R nobody /var/lib/minio
-
-RUN sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
-
-RUN su - postgres -c "/usr/lib/postgresql/14/bin/initdb -D /var/lib/postgresql/data"
-RUN echo "listen_addresses = '0.0.0.0'" >> /var/lib/postgresql/data/postgresql.conf
-
-RUN cd /var/lib \
-    && mkdir redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6 \
-    && chown redis:redis redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6 \
-    && chmod 750 redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6
-ADD etc/redis/* /etc/redis/
-
-RUN mkdir /run/php
-RUN echo "<?php phpinfo(); ?>" > /var/www/html/info.php
-RUN echo "daemon off;" >> /etc/nginx/nginx.conf
-ADD etc/nginx.conf /etc/nginx/sites-enabled/default
-
-ADD etc/envoy.yaml /etc/
-
-ADD etc/supervisor /etc/supervisor
-
-
+    
 RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
 
 VOLUME /workspace

+ 1 - 1
docker/jammy/build.sh

@@ -8,7 +8,7 @@ export CODE="palm-jammy"
 buildah pull ubuntu:jammy
 buildah bud --layers -t $CODE .
 podman save -o $CODE-$VERSION.tar $CODE
-XZ_OPT=-9 tar -cJf - $CODE-$VERSION.tar | split -d -b 1G - $CODE-$VERSION.tar.xz.
+XZ_OPT=-9 tar -cJf $CODE-$VERSION.tar.xz $CODE-$VERSION.tar
 md5sum $CODE-$VERSION.tar* > md5.txt
 
 echo "done($CODE-$VERSION.tar.xz)."

+ 2 - 7
docker/jammy/start.sh

@@ -6,11 +6,6 @@ export NAME="$CODE-$USER"
 if podman container exists $NAME
 then
     podman start -i -a $NAME
-else
-    if [ "$(uname)" == "Darwin" ]
-    then
-        podman run --name $NAME -it --hostname=palm --network host -v $PWD:/workspace:z $CODE
-    else
-        podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
-    fi
+else    
+    podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
 fi

+ 316 - 0
docker/spring/Dockerfile

@@ -0,0 +1,316 @@
+FROM ubuntu:latest
+LABEL maintainer="Jeremy Zheng"
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt update \
+    && apt -y upgrade \
+    && apt -y install debian-keyring debian-archive-keyring apt-transport-https software-properties-common curl wget gnupg
+
+# https://wiki.ubuntu.com/ToolChain
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" > /etc/apt/sources.list
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN dpkg --add-architecture armhf
+RUN dpkg --add-architecture arm64
+RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs) main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-security main restricted universe multiverse" >> /etc/apt/sources.list
+RUN echo "deb [arch=armhf,arm64] http://ports.ubuntu.com/ $(lsb_release -cs)-updates main restricted universe multiverse" >> /etc/apt/sources.list
+RUN apt update && apt -y upgrade
+
+RUN apt -y install zsh git locales locales-all rsync openssh-client sshpass \
+    vim tzdata pwgen zip unzip tree tmux dialog asciidoc doxygen \
+    net-tools dnsutils net-tools iputils-arping iputils-ping telnet \
+    imagemagick ffmpeg fonts-dejavu-extra texlive-full \
+    build-essential cmake pkg-config libtool automake autoconf autoconf-archive binutils cpio mold \
+    debhelper bison flex ninja-build \
+    musl-tools musl-dev \
+    crossbuild-essential-armhf crossbuild-essential-arm64 \
+    python3 python3-distutils python3-dev python3-pip virtualenv \
+    php-fpm php-mbstring php-json php-xml php-pear php-bcmath php-curl php-zip \
+    php-mysql php-pgsql php-sqlite3 php-redis php-mongodb php-amqp php-zmq \
+    php-imagick php-gd \
+    nginx rabbitmq-server redis postgresql mariadb-server
+
+# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
+ENV GCC_VERSION 12
+RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test
+RUN apt update
+RUN apt install -y g++-${GCC_VERSION} g++-${GCC_VERSION}-aarch64-linux-gnu g++-${GCC_VERSION}-arm-linux-gnueabihf \
+    libstdc++-${GCC_VERSION}-dev:amd64 libstdc++-${GCC_VERSION}-dev:arm64 libstdc++-${GCC_VERSION}-dev:armhf
+RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/aarch64-linux-gnu-gcc aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-gcc-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/aarch64-linux-gnu-g++ aarch64-linux-gnu-g++ /usr/bin/aarch64-linux-gnu-g++-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc /usr/bin/arm-linux-gnueabihf-gcc-${GCC_VERSION} 100 \
+    && update-alternatives --install /usr/bin/arm-linux-gnueabihf-g++ arm-linux-gnueabihf-g++ /usr/bin/arm-linux-gnueabihf-g++-${GCC_VERSION} 100
+
+# https://apt.llvm.org/
+ENV CLANG_VERSION=15
+RUN echo "deb [arch=amd64] http://apt.llvm.org/$(lsb_release -cs)/ llvm-toolchain-$(lsb_release -cs)-${CLANG_VERSION} main" > /etc/apt/sources.list.d/llvm.list
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
+RUN apt update
+RUN apt install -y clang-${CLANG_VERSION} \
+    clangd-${CLANG_VERSION} clang-tools-${CLANG_VERSION} clang-format-${CLANG_VERSION} \
+    lldb-${CLANG_VERSION} lld-${CLANG_VERSION}
+RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-${CLANG_VERSION} 100 \
+    && update-alternatives --install /usr/bin/lld lld /usr/bin/lld-${CLANG_VERSION} 100
+
+# https://www.envoyproxy.io/docs/envoy/latest/start/install#install-envoy-on-ubuntu-linux
+RUN curl -sL 'https://deb.dl.getenvoy.io/public/gpg.8115BA8E629CC074.key' | gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg
+RUN echo a077cb587a1b622e03aa4bf2f3689de14658a9497a9af2c427bba5f4cc3c4723 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check
+RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://deb.dl.getenvoy.io/public/deb/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/getenvoy.list
+RUN apt update && apt install -y getenvoy-envoy
+
+# https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
+# RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
+# RUN echo "deb [arch=amd64] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
+# RUN apt update
+# RUN apt install -y mongodb
+
+RUN apt -y autoremove && apt -y clean
+
+RUN echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
+    && locale-gen \
+    && update-locale LANG=en_US.UTF-8
+
+RUN update-alternatives --set editor /usr/bin/vim.basic
+
+RUN mkdir -p $HOME/downloads $HOME/build $HOME/local $HOME/tmp
+
+# https://github.com/ohmyzsh/ohmyzsh
+RUN git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
+RUN cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
+RUN echo 'export LANG=en_US.UTF-8' >> $HOME/.zshrc \
+    && echo 'export LC_ALL=en_US.UTF-8' >> $HOME/.zshrc \
+    && echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.zshrc
+
+RUN git config --global core.quotepath false \
+    && git config --global http.version HTTP/1.1 \
+    && git config --global pull.rebase false \
+    && git config --global url."https://".insteadOf git://
+RUN echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf \
+    && echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
+
+RUN zsh -c "source $HOME/.zshrc && pip3 install --user cmake"
+RUN zsh -c "source $HOME/.zshrc \
+    && pip3 install --user ansible paramiko"
+RUN echo 'export ANSIBLE_HOST_KEY_CHECKING=False' >> $HOME/.zshrc \
+    && echo 'alias peony="ANSIBLE_LOG_PATH=$HOME/tmp/$(date +%Y%m%d%H%M%S).log ansible-playbook"' >> $HOME/.zshrc
+
+RUN zsh -c "source $HOME/.zshrc \
+    && pip3 install --user conan \
+    && conan profile new default --detect \
+    && conan profile update settings.compiler.libcxx=libstdc++11 default"
+
+RUN zsh -c "source $HOME/.zshrc && pip3 install --user supervisor"
+
+# https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos
+RUN wget -q -O $HOME/downloads/composer https://getcomposer.org/installer
+RUN cd $HOME/downloads \
+    && php composer \
+    && mv composer.phar $HOME/.local/bin/composer
+
+# https://github.com/richfelker/musl-cross-make
+RUN git clone https://github.com/richfelker/musl-cross-make.git $HOME/build/musl-cross-make
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=x86_64-linux-musl" > config.mak \
+    && echo "OUTPUT=/opt/crosstools" >> config.mak \
+    && make \
+    && make install 
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=aarch64-linux-musl" > config.mak \
+    && echo "OUTPUT=/opt/crosstools" >> config.mak \
+    && make \
+    && make install
+RUN cd $HOME/build/musl-cross-make \
+    && echo "TARGET=arm-linux-musleabihf" > config.mak \
+    && echo "OUTPUT=/opt/crosstools" >> config.mak \
+    && make \
+    && make install
+RUN echo 'export PATH=/opt/crosstools/bin:$PATH' >> $HOME/.zshrc
+
+# https://github.com/bazelbuild/bazelisk
+ENV BAZEL_VERSION "v1.15.0"
+RUN wget -q -O $HOME/.local/bin/bazel \
+    https://github.com/bazelbuild/bazelisk/releases/download/${BAZEL_VERSION}/bazelisk-linux-amd64
+RUN chmod +x $HOME/.local/bin/bazel
+
+# https://github.com/rbenv/rbenv
+ENV RUBY_VERSION "3.2.0"
+RUN git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv \
+    && git clone https://github.com/rbenv/ruby-build.git $HOME/.rbenv/plugins/ruby-build \
+    && git clone https://github.com/rbenv/rbenv-vars.git $HOME/.rbenv/plugins/rbenv-vars 
+RUN cd $HOME/.rbenv && src/configure && make -C src
+RUN echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.zshrc \
+    && echo 'eval "$(rbenv init -)"' >> $HOME/.zshrc
+# https://github.com/rbenv/ruby-build
+RUN apt install -y libssl-dev libyaml-dev
+RUN zsh -c "source $HOME/.zshrc \
+    && rbenv install ${RUBY_VERSION} \
+    && rbenv global ${RUBY_VERSION} \
+    && gem install bundler"
+RUN zsh -c "source $HOME/.zshrc && rbenv global ${RUBY_VERSION}"
+
+ENV GO_VERSION "1.19.5"
+RUN wget -q -P $HOME/downloads https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
+RUN tar xf $HOME/downloads/go${GO_VERSION}.linux-amd64.tar.gz -C $HOME/local
+RUN echo 'export GOROOT=$HOME/local/go' >> $HOME/.zshrc \
+    && echo 'export PATH=$GOROOT/bin:$PATH' >> $HOME/.zshrc \
+    && echo 'export GOPATH=$HOME/go' >> $HOME/.zshrc
+
+ENV JDK_VERSION "19.0.1-open"
+RUN curl -s "https://get.sdkman.io" | zsh
+RUN sed -i -e 's/sdkman_auto_answer=false/sdkman_auto_answer=true/g' $HOME/.sdkman/etc/config
+RUN zsh -c "source $HOME/.zshrc \
+    && sdk install java ${JDK_VERSION} \
+    && sdk install maven \
+    && sdk install gradle"
+
+# https://github.com/nvm-sh/nvm
+ENV NVM_VERSION "v0.39.3"
+RUN git clone -b ${NVM_VERSION} https://github.com/nvm-sh/nvm.git $HOME/.nvm
+RUN echo 'export NVM_DIR="$HOME/.nvm"' >> $HOME/.zshrc \
+    && echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $HOME/.zshrc \
+    && echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> $HOME/.zshrc
+RUN zsh -c "source $HOME/.zshrc \
+    && nvm install node \
+    && nvm use node \
+    && npm i yarn -g"
+RUN zsh -c "source $HOME/.zshrc \
+    && nvm install --lts \
+    && nvm use --lts \
+    && npm i yarn -g"
+# https://stackoverflow.com/questions/37324519/node-sass-does-not-yet-support-your-current-environment-linux-64-bit-with-false
+RUN zsh -c "source $HOME/.zshrc \
+    && nvm install lts/fermium \
+    && nvm use lts/fermium \
+    && npm i yarn -g"
+RUN echo 'export PATH=$HOME/.yarn/bin:$PATH' >> $HOME/.zshrc
+
+# https://www.rust-lang.org/tools/install
+RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+# https://doc.rust-lang.org/nightly/rustc/platform-support.html
+RUN zsh -c "source $HOME/.cargo/env \
+    && rustup component add rust-analyzer \
+    && rustup target add armv7-unknown-linux-gnueabihf \
+    && rustup target add aarch64-unknown-linux-gnu \
+    && rustup target add x86_64-unknown-linux-musl \
+    && rustup target add aarch64-unknown-linux-musl"
+
+
+RUN apt install -y libpq-dev libmysqlclient-dev libsqlite3-dev
+RUN zsh -c "source $HOME/.zshrc \
+    && cargo install diesel_cli \
+    && cargo install --locked cargo-outdated \
+    && cargo install mdbook"
+
+# https://opensearch.org/downloads.html#opensearch
+ENV OPENSEARCH_VERSION "2.4.1"
+RUN wget -q -P $HOME/downloads \
+    https://artifacts.opensearch.org/releases/bundle/opensearch/${OPENSEARCH_VERSION}/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz
+RUN tar xf $HOME/downloads/opensearch-${OPENSEARCH_VERSION}-linux-x64.tar.gz -C /opt
+
+# https://min.io/download#/linux
+RUN wget -q -O /usr/bin/minio \
+    https://dl.min.io/server/minio/release/linux-amd64/minio
+RUN chmod +x /usr/bin/minio
+
+# https://github.com/grpc/grpc
+ENV GRPC_VERSION "v1.51.1"
+RUN git clone --recurse-submodules -b $GRPC_VERSION https://github.com/grpc/grpc.git $HOME/downloads/grpc
+# ENV PROTOBUF_VERSION "v3.21.8"
+# RUN cd $HOME/downloads/grpc/third_party/protobuf \
+#     && git checkout ${PROTOBUF_VERSION} \
+#     && git submodule update --init --recursive
+RUN zsh -c "source $HOME/.zshrc \
+    && mkdir -pv $HOME/build/grpc \
+    && cd $HOME/build/grpc \
+    && cmake -DCMAKE_BUILD_TYPE=Release \
+        -DgRPC_INSTALL=ON \
+        -DgRPC_SSL_PROVIDER=package \
+        -DgRPC_BUILD_TESTS=OFF \
+        -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/grpc \
+    && make -j \
+    && make install"
+
+# https://github.com/grpc/grpc-web#code-generator-plugin
+ENV GRPC_WEB_PLUGIN_VERSION "1.4.2"
+RUN wget -q -O $HOME/.local/bin/protoc-gen-grpc-web \
+    https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_PLUGIN_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_PLUGIN_VERSION}-linux-x86_64
+RUN chmod +x $HOME/.local/bin/protoc-gen-grpc-web
+
+# https://github.com/protocolbuffers/protobuf-javascript
+ENV GRPC_JS_PLUGIN_VERSION "3.21.2"
+RUN wget -q -P $HOME/downloads \
+    https://github.com/protocolbuffers/protobuf-javascript/releases/download/v${GRPC_JS_PLUGIN_VERSION}/protobuf-javascript-${GRPC_JS_PLUGIN_VERSION}-linux-x86_64.tar.gz
+RUN mkdir -p $HOME/build/protobuf-javascript \
+    && cd $HOME/build/protobuf-javascript \
+    && tar xf $HOME/downloads/protobuf-javascript-${GRPC_JS_PLUGIN_VERSION}-linux-x86_64.tar.gz \
+    && cp bin/protoc-gen-js $HOME/.local/bin/
+
+# https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/
+ENV GRPC_JAVA_PLUGIN_VERSION "1.52.1"
+RUN wget -q -O $HOME/.local/bin/grpc_java_plugin \
+    https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/${GRPC_JAVA_PLUGIN_VERSION}/protoc-gen-grpc-java-${GRPC_JAVA_PLUGIN_VERSION}-linux-x86_64.exe
+RUN chmod +x $HOME/.local/bin/grpc_java_plugin
+
+# https://github.com/google/flatbuffers
+ENV FLATBUFFERS_VERSION "v23.1.4"
+RUN git clone -b $FLATBUFFERS_VERSION https://github.com/google/flatbuffers.git $HOME/downloads/flatbuffers
+RUN zsh -c "source $HOME/.zshrc \
+    && mkdir -pv $HOME/build/flatbuffers \
+    && cd $HOME/build/flatbuffers \
+    && cmake -DCMAKE_BUILD_TYPE=Release \
+        -DCMAKE_INSTALL_PREFIX=$HOME/.local $HOME/downloads/flatbuffers \
+    && make -j \
+    && make install"
+
+# https://github.com/microsoft/vcpkg
+RUN git clone https://github.com/microsoft/vcpkg.git $HOME/local/vcpkg
+RUN $HOME/local/vcpkg/bootstrap-vcpkg.sh \
+    && echo 'export VCPKG_DISABLE_METRICS=1' >> $HOME/.zshrc
+
+ADD conan /opt/conan
+# RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh amd64"
+# RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh arm64"
+# RUN zsh -c "source $HOME/.zshrc && cd /opt/conan && ./install.sh armhf"
+
+# https://opensearch.org/docs/latest/opensearch/install/tar/
+RUN echo "network.host: 0.0.0.0" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml \
+    && echo "discovery.type: single-node" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml \
+    && echo "plugins.security.disabled: true" >> /opt/opensearch-${OPENSEARCH_VERSION}/config/opensearch.yml \
+    && chown -R nobody /opt/opensearch-${OPENSEARCH_VERSION}
+
+RUN mkdir -p /var/lib/minio/data \
+    && chown -R nobody /var/lib/minio
+
+RUN sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
+
+RUN su - postgres -c "/usr/lib/postgresql/14/bin/initdb -D /var/lib/postgresql/data"
+RUN echo "listen_addresses = '0.0.0.0'" >> /var/lib/postgresql/data/postgresql.conf \
+    && echo "host  all  all 0.0.0.0/0 md5" >> /var/lib/postgresql/data/pg_hba.conf
+
+ADD etc/redis/* /etc/redis/
+RUN cd /var/lib \
+    && mkdir redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6 \
+    && chown redis:redis redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6 \
+    && chmod 750 redis-s redis-1 redis-2 redis-3 redis-4 redis-5 redis-6
+
+RUN mkdir /run/php \
+    && echo "<?php phpinfo(); ?>" > /var/www/html/info.php \
+    && echo "daemon off;" >> /etc/nginx/nginx.conf
+ADD etc/nginx.conf /etc/nginx/sites-enabled/default
+
+ADD etc/envoy.yaml /etc/
+ADD etc/supervisor /etc/supervisor
+
+RUN echo "$(date -u +%4Y%m%d%H%M%S)" | tee /VERSION
+
+VOLUME /workspace
+WORKDIR /workspace
+
+CMD ["/bin/zsh", "-l"]

+ 63 - 0
docker/spring/README.md

@@ -0,0 +1,63 @@
+# USAGE
+
+- add to `/etc/sysctl.d/60-my.conf` and then `reboot` or `sysctl -p`
+
+  ```text
+  vm.overcommit_memory = 1
+  vm.max_map_count = 262144
+  ```
+
+- start container [dashboard](http://localhost:10001)
+
+  ```bash
+  $ cd ~/workspace
+  $ ./saturn-xiv/palm/docker/spring/start.sh
+  > supervisord -c /etc/supervisor/supervisord.conf
+  # init redis cluster
+  > /etc/redis/clusters-init.sh
+  ```
+
+- PostgreSql
+
+  ```bash
+  psql -h 127.0.0.1 -p 5432 -U postgres
+  ```
+
+- MySql
+
+  ```bash
+  # reset root's password
+  mysql_secure_installation
+  ```
+
+- Redis
+
+  ```bash
+  # connect to redis node-1
+  redis-cli -c -h 127.0.0.1 -p 16371
+  ```
+
+- Minio [dashboard](http://localhost:9001) (`admin:12345678`)
+
+- RabbitMQ [dashboard](http://localhost:15672) (`guest:guest`)
+
+  ```bash
+  # enable rabbitmq management plugin
+  rabbitmq-plugins enable rabbitmq_management
+  ```
+
+- Php [info.php](http://localhost:8080/info.php)
+
+- OpenSearch
+
+  ```bash
+  # show info
+  curl -X GET http://localhost:9200
+  curl -X GET http://localhost:9200/_cat/plugins?v
+  ```
+
+- Vcpkg
+
+  ```bash
+  $HOME/local/vcpkg/vcpkg upgrade --no-dry-run
+  ```

+ 16 - 0
docker/spring/build.sh

@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+export VERSION=$(date "+%4Y%m%d%H%M%S")
+export CODE="palm-spring"
+
+buildah pull ubuntu:latest
+buildah bud --layers -t $CODE .
+podman save -o $CODE-$VERSION.tar $CODE
+XZ_OPT=-9 tar -cJf - $CODE-$VERSION.tar | split -d -b 3G - $CODE-$VERSION.tar.xz.
+md5sum $CODE-$VERSION.tar* > md5.txt
+
+echo "done($CODE-$VERSION.tar.xz)."
+
+exit 0

+ 0 - 0
docker/jammy/conan/conanfile.txt → docker/spring/conan/conanfile.txt


+ 0 - 0
docker/jammy/conan/install.sh → docker/spring/conan/install.sh


+ 0 - 0
docker/jammy/conan/profiles/amd64 → docker/spring/conan/profiles/amd64


+ 0 - 0
docker/jammy/conan/profiles/arm64 → docker/spring/conan/profiles/arm64


+ 0 - 0
docker/jammy/conan/profiles/armhf → docker/spring/conan/profiles/armhf


+ 0 - 0
docker/jammy/conan/toolchains/amd64.cmake → docker/spring/conan/toolchains/amd64.cmake


+ 0 - 0
docker/jammy/conan/toolchains/arm64.cmake → docker/spring/conan/toolchains/arm64.cmake


+ 0 - 0
docker/jammy/conan/toolchains/armhf.cmake → docker/spring/conan/toolchains/armhf.cmake


+ 0 - 0
docker/jammy/etc/envoy.yaml → docker/spring/etc/envoy.yaml


+ 1 - 0
docker/jammy/etc/nginx.conf → docker/spring/etc/nginx.conf

@@ -18,3 +18,4 @@ server {
         fastcgi_pass unix:/run/php/php8.1-fpm.sock;
     }
 }
+

+ 0 - 0
docker/jammy/etc/redis/clusters-init.sh → docker/spring/etc/redis/clusters-init.sh


+ 0 - 0
docker/jammy/etc/redis/node-1.conf → docker/spring/etc/redis/node-1.conf


+ 0 - 0
docker/jammy/etc/redis/node-2.conf → docker/spring/etc/redis/node-2.conf


+ 0 - 0
docker/jammy/etc/redis/node-3.conf → docker/spring/etc/redis/node-3.conf


+ 0 - 0
docker/jammy/etc/redis/node-4.conf → docker/spring/etc/redis/node-4.conf


+ 0 - 0
docker/jammy/etc/redis/node-5.conf → docker/spring/etc/redis/node-5.conf


+ 0 - 0
docker/jammy/etc/redis/node-6.conf → docker/spring/etc/redis/node-6.conf


+ 0 - 0
docker/jammy/etc/redis/node-s.conf → docker/spring/etc/redis/node-s.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/envoy.conf → docker/spring/etc/supervisor/conf.d/envoy.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/minio.conf → docker/spring/etc/supervisor/conf.d/minio.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/mysql.conf → docker/spring/etc/supervisor/conf.d/mysql.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/nginx.conf → docker/spring/etc/supervisor/conf.d/nginx.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/opensearch.conf → docker/spring/etc/supervisor/conf.d/opensearch.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/php-fpm.conf → docker/spring/etc/supervisor/conf.d/php-fpm.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/postgresql.conf → docker/spring/etc/supervisor/conf.d/postgresql.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/rabbitmq.conf → docker/spring/etc/supervisor/conf.d/rabbitmq.conf


+ 0 - 0
docker/jammy/etc/supervisor/conf.d/redis.conf → docker/spring/etc/supervisor/conf.d/redis.conf


+ 0 - 0
docker/jammy/etc/supervisor/supervisord.conf → docker/spring/etc/supervisor/supervisord.conf


+ 11 - 0
docker/spring/start.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+
+export CODE="palm-spring"
+export NAME="$CODE-$USER"
+
+if podman container exists $NAME
+then
+    podman start -i -a $NAME
+else    
+    podman run --name $NAME -it --events-backend=file --hostname=palm --network host -v $PWD:/workspace:z $CODE
+fi