diff --git a/.gitea/workflows/docker.yaml b/.gitea/workflows/docker.yaml new file mode 100644 index 0000000..c2b13a8 --- /dev/null +++ b/.gitea/workflows/docker.yaml @@ -0,0 +1,62 @@ +name: Deploy Docker Images +run-name: build and deploy docker image to server. +on: [push] +jobs: + Docusaurus build and Server deploy: + runs-on: ubuntu-latest + steps: + - name: Set up SSH + run: | + mkdir -p ~/.ssh/ + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan -t ed25519 -p 22022 frp-by1.wwvvww.cn >> ~/.ssh/known_hosts + - name: Clone repository + run: | + echo "git clone --depth 1 --branch=${GITHUB_REF##*/} ssh://git@frp-by1.wwvvww.cn:22022/${{ gitea.repository }}.git" + git clone --depth 1 --branch=${GITHUB_REF##*/} ssh://git@frp-by1.wwvvww.cn:22022/${{ gitea.repository }}.git . + git checkout ${GITHUB_SHA} + - name: Notify-Start + if: ${{ always() }} + run: | + echo "${{ github.repository }} 开始构建..." > notify.tpl + echo "构建地址: https://amass.fun/gitea/${{ github.repository }}/actions/runs/${{ github.run_number }}">> notify.tpl + echo "仓库地址: https://amass.fun/gitea/${{ github.repository }}">> notify.tpl + echo "提交ID: $(git rev-parse --short HEAD)">> notify.tpl + echo -n "提交消息: ${{ github.event.head_commit.message }}">> notify.tpl + cat notify.tpl | envsubst | jq -sR . | xargs -0 -I {} curl -H "Content-Type: application/json" -X POST -d '{"type":"text","msg":{} }' https://amass.fun/notify + - name: Get changed files + id: changed-dockerfiles + uses: tj-actions/changed-files@v42 + with: + files: | + **.dockerfile + - name: List changed dockerfiles. + run: | + for file in ${{ steps.changed-dockerfiles.outputs.all_changed_files }}; do + echo "${file} changed." + done + - name: Login to ACR + uses: aliyun/acr-login@v1 + with: + login-server: https://registry.cn-shenzhen.aliyuncs.com + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build docker image and deploy. + run: | + for file in ${{ steps.changed-dockerfiles.outputs.all_changed_files }}; do + echo "${file} changed." + resources/build.sh docker ${file} + done + - name: Clean Docker Image + run: docker images -f "dangling=true" -q | xargs -r docker rmi || true + - name: Notify-End + if: ${{ always() }} + run: | + echo "${{ github.repository }} 构建结束" > notify.tpl + echo "构建状态: ${{ job.status }}">> notify.tpl + echo "构建地址: https://amass.fun/gitea/${{ github.repository }}/actions/runs/${{ github.run_number }}">> notify.tpl + echo "仓库地址: https://amass.fun/gitea/${{ github.repository }}">> notify.tpl + echo "提交ID: $(git rev-parse --short HEAD)">> notify.tpl + echo -n "提交消息: ${{ github.event.head_commit.message }}">> notify.tpl + cat notify.tpl | envsubst | jq -sR . | xargs -0 -I {} curl -H "Content-Type: application/json" -X POST -d '{"type":"text","msg":{} }' https://amass.fun/notify diff --git a/Dockerfiles/act_runner.dockerfile b/Dockerfiles/act_runner.dockerfile new file mode 100644 index 0000000..51df444 --- /dev/null +++ b/Dockerfiles/act_runner.dockerfile @@ -0,0 +1,27 @@ +FROM ubuntu:24.04 + +LABEL maintainer="amass <168062547@qq.com>" + +ENV DEBIAN_FRONTEND=noninteractive + +ENV ACT_VERSION 0.2.11 + +RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources \ + && apt update \ + && apt install -y ca-certificates curl git gettext jq tini \ + && curl https://gitea.com/gitea/act_runner/releases/download/v${ACT_VERSION}/act_runner-${ACT_VERSION}-linux-amd64 -o /usr/local/bin/act_runner \ + && chmod +x /usr/local/bin/act_runner \ + && install -m 0755 -d /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \ + && chmod a+r /etc/apt/keyrings/docker.asc \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \ + && apt update \ + && apt install -y docker-ce-cli nodejs + +COPY resources/act_runner.sh /opt/act/run.sh + +ENTRYPOINT ["tini","--","/opt/act/run.sh"] + +# docker build --progress tty -f act_runner.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/act_runner:0.2.11 . +# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/act_runner:0.2.11 \ No newline at end of file diff --git a/Dockerfiles/frpc.dockerfile b/Dockerfiles/frpc.dockerfile new file mode 100644 index 0000000..523faeb --- /dev/null +++ b/Dockerfiles/frpc.dockerfile @@ -0,0 +1,30 @@ +FROM amd64/alpine:3.18 + +LABEL maintainer="amass <168062547@qq.com>" + +ENV FRP_VERSION 0.61.0 + +RUN apk add openssl curl ca-certificates \ + && wget 'http://openresty.org/package/admin@openresty.com-5ea678a6.rsa.pub' \ + && mv 'admin@openresty.com-5ea678a6.rsa.pub' /etc/apk/keys/ \ + && . /etc/os-release \ + && MAJOR_VER=`echo $VERSION_ID | sed 's/\.[0-9]\+$//'` \ + && echo "http://openresty.org/package/alpine/v$MAJOR_VER/main" | tee -a /etc/apk/repositories \ + && apk update \ + && apk add openresty openresty-resty openresty-opm \ + && opm get bungle/lua-resty-session + +RUN cd /root \ + && wget --no-check-certificate -c https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz \ + && tar zxvf frp_${FRP_VERSION}_linux_amd64.tar.gz \ + && cd frp_${FRP_VERSION}_linux_amd64/ \ + && cp frpc /usr/bin/ \ + && mkdir -p /etc/frp \ + && cp frpc.toml /etc/frp \ + && cd /root \ + && rm frp_${FRP_VERSION}_linux_amd64.tar.gz \ + && rm -rf frp_${FRP_VERSION}_linux_amd64/ + +ENTRYPOINT if [ -d /app ]; then cd /app && openresty -p /app; fi; /usr/bin/frpc -c /etc/frp/frpc.toml + +# docker build --progress=tty -f frpc.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/frpc:0.61.0 . \ No newline at end of file diff --git a/Dockerfiles/jenkins.dockerfile b/Dockerfiles/jenkins.dockerfile new file mode 100644 index 0000000..eda8631 --- /dev/null +++ b/Dockerfiles/jenkins.dockerfile @@ -0,0 +1,54 @@ +FROM registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:latest +LABEL maintainer 168062547@qq.com + +ARG user=jenkins +ARG group=jenkins +ARG uid=1000 +ARG gid=1000 +# ARG http_port=8080 +# ARG agent_port=50000 + +ENV JENKINS_HOME /var/jenkins_home +ENV JENKINS_SLAVE_AGENT_PORT ${agent_port} + + +RUN groupadd -g ${gid} ${group} \ + && useradd -d "$JENKINS_HOME" -u ${uid} -g ${gid} -m -s /bin/bash ${user} +RUN chown -R ${user} "$JENKINS_HOME" + +RUN curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | tee \ + /usr/share/keyrings/jenkins-keyring.asc > /dev/null +RUN echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \ + https://pkg.jenkins.io/debian-stable binary/ | tee \ + /etc/apt/sources.list.d/jenkins.list > /dev/null + +RUN mkdir -p /etc/apt/keyrings +RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg +RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null + +RUN apt-get update +RUN apt-get install -y jenkins openjdk-11-jre docker-ce-cli python2 + +ENV TINI_VERSION 0.19.0 +ENV TINI_SHA c5b0666b4cb676901f90dfcb37106783c5fe2077b04590973b885950611b30ee + +# Use tini as subreaper in Docker container to adopt zombie processes +RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /sbin/tini && chmod +x /sbin/tini \ + && echo "$TINI_SHA /sbin/tini" | sha256sum -c - + +RUN wget https://bootstrap.pypa.io/pip/2.7/get-pip.py +RUN python2 ./get-pip.py +RUN update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1 +RUN pip2 install pyyaml python-jenkins -i https://mirrors.aliyun.com/pypi/simple/ + +VOLUME /var/jenkins_home +USER ${user} +ENTRYPOINT ["/sbin/tini", "--", "jenkins"] + +# docker build -t jl_jenkins . +# docker run -p 8080:8080 -p 50000:50000 --rm -d --volume jenkins-data:/var/jenkins_home registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:jenkins + +# docker tag d97263da6c6f registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:jenkins +# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:jenkins +# docker run --rm -it registry.cn-shenzhen.aliyuncs.com/amass_toolset/jl_develop:latest \ No newline at end of file diff --git a/Dockerfiles/nanopb.dockerfile b/Dockerfiles/nanopb.dockerfile new file mode 100644 index 0000000..2f0bff7 --- /dev/null +++ b/Dockerfiles/nanopb.dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:24.04 +LABEL maintainer 168062547@qq.com +ENV DEBIAN_FRONTEND=noninteractive + +RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources && \ + dpkg --add-architecture i386 && \ + apt-get update && \ + apt-get install -y make cmake ninja-build openssh-client wget gcc g++ libc6:i386 libstdc++6:i386 + +RUN cd /opt && \ + wget https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.3-linux-x86.tar.gz && \ + tar xvf nanopb-0.3.9.3-linux-x86.tar.gz && \ + rm nanopb-0.3.9.3-linux-x86.tar.gz + +ENV PATH="${PATH}:/opt/nanopb-0.3.9.3-linux-x86/generator-bin" +ENV PATH="${PATH}:/opt/arm-himix200-linux/bin" + +# docker build -f nanopb.dockerfile -t frp-by1.wwvvww.cn:45288/nanopb:0.3.9.3 . +# docker push frp-by1.wwvvww.cn:45288/nanopb:0.3.9.3 +# docker run -it --rm --user 1000:1000 -v /opt:/opt -v $(pwd):$(pwd) -w $(pwd) frp-by1.wwvvww.cn:45288/nanopb:0.3.9.3 make server_protocol +# docker run -it --rm --user 1000:1000 -v /opt:/opt -v $(pwd):$(pwd) -w $(pwd) frp-by1.wwvvww.cn:45288/nanopb:0.3.9.3 make -j6 \ No newline at end of file diff --git a/Dockerfiles/ubuntu1604.dockerfile b/Dockerfiles/ubuntu1604.dockerfile new file mode 100644 index 0000000..fd4bbbd --- /dev/null +++ b/Dockerfiles/ubuntu1604.dockerfile @@ -0,0 +1,48 @@ +FROM ubuntu:16.04 +LABEL maintainer="amass <168062547@qq.com>" +ENV DEBIAN_FRONTEND=noninteractive + +RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list \ + && sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list \ + && apt-get update \ + && apt-get install -y apt-transport-https software-properties-common gcc g++ cmake ninja-build pkg-config openssh-server git nano \ + ca-certificates wget curl rsync lsb-release ubuntu-keyring gnupg2 libssl-dev gettext jq qt5-default \ + && install -m 0755 -d /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ + && add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ + && wget -O - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/openresty.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list > /dev/null \ + && apt-get update \ + && apt-get install -y docker-ce-cli openresty nodejs + +RUN git config --global core.quotepath false \ + && git config --global user.email "168062547@qq.com" \ + && git config --global user.name "amass" + +RUN mkdir /var/run/sshd \ + && sed -i 's/#Port 22/Port 1022/' /etc/ssh/sshd_config \ + && sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config \ + && mkdir -p /root/.ssh \ + && wget https://frp-by1.wwvvww.cn:44048/s/id_ed25519/download -O /root/.ssh/authorized_keys \ + && chmod 600 /root/.ssh/authorized_keys && chown root:root /root/.ssh/authorized_keys + + +EXPOSE 1022 + +RUN cd /root \ + && wget https://frp-by1.wwvvww.cn:44048/s/boost_1_86_0/download -O boost_1_86_0.tar.gz \ + && tar xvf boost_1_86_0.tar.gz > /dev/null \ + && cd /root/boost_1_86_0 \ + && ./bootstrap.sh --prefix=/opt/Libraries/boost_1_86_0 \ + && ./b2 install -q --prefix=/opt/Libraries/boost_1_86_0 threading=multi link=shared runtime-link=shared variant=release cxxstd=11 cxxflags=-fPIC cflags=-fPIC \ + && rm -fr /root/boost_1_86_0* + +ENV LD_LIBRARY_PATH=/opt/Libraries/boost_1_86_0/lib:$LD_LIBRARY_PATH +CMD ["service", "ssh", "start", "-D"] + +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 +ENV TERM=xterm-256color + +# docker build --progress=tty -f ubuntu1604.dockerfile -t frp-by1.wwvvww.cn:45288/ubuntu_dev:16.04 . +# docker push frp-by1.wwvvww.cn:45288/ubuntu_dev:16.04 \ No newline at end of file diff --git a/Dockerfiles/ubuntu2204.dockerfile b/Dockerfiles/ubuntu2204.dockerfile new file mode 100644 index 0000000..2d3a637 --- /dev/null +++ b/Dockerfiles/ubuntu2204.dockerfile @@ -0,0 +1,125 @@ +FROM ubuntu:22.04 +LABEL maintainer="amass <168062547@qq.com>" +ENV DEBIAN_FRONTEND=noninteractive + +ENV CODE_VERSION=4.93.1 + +RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list \ + && sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list \ + && apt update \ + && apt install -y gcc g++ gdb cmake ninja-build pkg-config openssh-server git nano gpg ca-certificates \ + wget curl rsync lsb-release ubuntu-keyring gnupg2 bzip2 zsh libssl-dev zlib1g-dev gettext jq htop tini \ + && install -m 0755 -d /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \ + && chmod a+r /etc/apt/keyrings/docker.asc \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && wget -O - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/openresty.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list > /dev/null \ + && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \ + && apt update \ + && apt install -y docker-ce-cli openresty nodejs \ + && apt clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN git config --global core.quotepath false \ + && git config --global user.email "168062547@qq.com" \ + && git config --global user.name "amass" + +RUN mkdir /var/run/sshd \ + && sed -i 's/#Port 22/Port 1022/' /etc/ssh/sshd_config \ + && sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config \ + && mkdir -p /root/.ssh \ + && wget https://frp-by1.wwvvww.cn:44048/s/id_ed25519/download -O /root/.ssh/authorized_keys \ + && chmod 600 /root/.ssh/authorized_keys && chown root:root /root/.ssh/authorized_keys + +EXPOSE 1022 + +RUN curl -fOL https://github.com/coder/code-server/releases/download/v$CODE_VERSION/code-server_${CODE_VERSION}_amd64.deb \ + && dpkg -i code-server_${CODE_VERSION}_amd64.deb \ + && rm code-server_${CODE_VERSION}_amd64.deb + +RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \ + && git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \ + && git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \ + && git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k \ + && sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' /root/.zshrc \ + && sed -i 's/plugins=(.*)/plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)/' /root/.zshrc \ + && chsh -s /bin/zsh root + +RUN cd /root \ + && apt update \ + && apt install -y libgl1-mesa-dev libfontconfig1-dev libfreetype-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev \ + && apt install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavfilter-dev libavdevice-dev \ + && apt clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && wget https://download.qt.io/official_releases/qt/6.8/6.8.0/single/qt-everywhere-src-6.8.0.tar.xz \ + && tar -xvf qt-everywhere-src-6.8.0.tar.xz \ + && cd ./qt-everywhere-src-6.8.0 \ + && ./configure -prefix /opt/Qt/6.8.0/gcc_64 -opensource -debug-and-release -confirm-license -nomake examples -nomake tests -skip qtwebengine -skip qtcoap -skip qtopcua \ + && cmake --build . --parallel \ + && ninja install \ + && rm -fr /root/qt-everywhere-src-6.8.0* \ + && echo 'export PATH=/opt/Qt/6.8.0/gcc_64/bin:$PATH' >> /etc/zsh/zshenv \ + && echo 'export PATH=/opt/Qt/6.8.0/gcc_64/bin:$PATH' >> /etc/profile + +RUN cd /root \ + && wget https://frp-by1.wwvvww.cn:44048/s/boost_1_86_0/download -O boost_1_86_0.tar.gz \ + && tar xvf boost_1_86_0.tar.gz > /dev/null \ + && cd /root/boost_1_86_0 \ + && ./bootstrap.sh --prefix=/opt/Libraries/boost_1_86_0 \ + && ./b2 install -q --prefix=/opt/Libraries/boost_1_86_0 threading=multi link=shared runtime-link=shared variant=release cxxstd=17 cxxflags=-fPIC cflags=-fPIC \ + && echo 'export LD_LIBRARY_PATH=/opt/Libraries/boost_1_86_0/lib:$LD_LIBRARY_PATH' >> /etc/profile \ + && rm -fr /root/boost_1_86_0* + +RUN cd /root \ + && wget https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2 \ + && tar xvf mbedtls-3.6.2.tar.bz2 \ + && cd /root/mbedtls-3.6.2 \ + && cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/Libraries/mbedtls-3.6.2 \ + && cmake --build build --target all \ + && cmake --install build \ + && rm -fr /root/mbedtls-3.6.2* + +RUN cd /root \ + && wget https://github.com/nanomsg/nng/archive/refs/tags/v1.9.0.tar.gz -O nng-1.9.0.tar.gz \ + && tar xvf nng-1.9.0.tar.gz \ + && cd /root/nng-1.9.0 \ + && sed -i 's/# PATH_SUFFIXES lib/PATH_SUFFIXES lib/' cmake/FindMbedTLS.cmake \ + && sed -i '/_MBEDTLS_LIBRARY/{n;n;n;n;s/#PATH_SUFFIXES lib/PATH_SUFFIXES lib/}' cmake/FindMbedTLS.cmake \ + && cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/Libraries/nng-1.9.0 -DNNG_ELIDE_DEPRECATED=ON -DNNG_ENABLE_TLS=ON -DMBEDTLS_ROOT=/opt/Libraries/mbedtls-3.6.2 -D_MBEDTLS_V2_OR_NEWER=ON \ + && cmake --build build --target all \ + && cmake --install build \ + && rm -fr /root/nng-1.9.0* + +RUN cd /root \ + && wget https://github.com/emweb/wt/archive/4.11.0.tar.gz -O wt-4.11.0.tar.gz \ + && tar xvf wt-4.11.0.tar.gz \ + && cd /root/wt-4.11.0 \ + && cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/Libraries/wt-4.11.0 -DENABLE_QT4=OFF -DENABLE_QT5=OFF -DENABLE_QT6=OFF -DBOOST_ROOT=/opt/Libraries/boost_1_86_0 \ + && cmake --build build --target all \ + && cmake --install build \ + && rm -fr /root/wt-4.11.0* + +RUN cd /root \ + && git clone --depth=1 --recursive https://github.com/ZLMediaKit/ZLMediaKit.git \ + && cd /root/ZLMediaKit \ + && apt update \ + && apt install -y libsrtp2-dev libusrsctp-dev \ + && apt clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && cmake -G Ninja -B build -S . -DENABLE_OPENSSL=true -DENABLE_WEBRTC=true -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/Libraries/ZLMediaKit" \ + && cmake --build build --target all \ + && cmake --install build \ + && echo 'export LD_LIBRARY_PATH=/opt/Libraries/ZLMediaKit/lib:$LD_LIBRARY_PATH' >> /etc/profile \ + && rm -fr /root/ZLMediaKit + +ENV LD_LIBRARY_PATH=/opt/Libraries/boost_1_86_0/lib:/opt/Libraries/ZLMediaKit/lib +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 +ENV TERM=xterm-256color + +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["bash", "-c", "service ssh start && code-server --bind-addr 0.0.0.0:8087"] + +# docker build --progress=tty -f ubuntu2204.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:22.04 . +# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:22.04 \ No newline at end of file diff --git a/Dockerfiles/ubuntu2404.dockerfile b/Dockerfiles/ubuntu2404.dockerfile new file mode 100644 index 0000000..a3bdd4d --- /dev/null +++ b/Dockerfiles/ubuntu2404.dockerfile @@ -0,0 +1,127 @@ +FROM ubuntu:24.04 +LABEL maintainer="amass <168062547@qq.com>" +ENV DEBIAN_FRONTEND=noninteractive + +ENV CODE_VERSION=4.93.1 + +RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources \ + && apt update \ + && apt install -y gcc g++ gdb cmake ninja-build pkg-config openssh-server git nano gpg ca-certificates \ + wget curl rsync lsb-release ubuntu-keyring gnupg2 libssl-dev zlib1g-dev gettext jq bzip2 xz-utils zsh htop tini \ + && install -m 0755 -d /etc/apt/keyrings \ + && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc \ + && chmod a+r /etc/apt/keyrings/docker.asc \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null \ + && wget -O - https://openresty.org/package/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/openresty.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/openresty.gpg] http://openresty.org/package/ubuntu $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/openresty.list > /dev/null \ + && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \ + && apt update \ + && apt install -y docker-ce-cli openresty nodejs \ + && apt clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN curl -fOL https://github.com/coder/code-server/releases/download/v$CODE_VERSION/code-server_${CODE_VERSION}_amd64.deb \ + && dpkg -i code-server_${CODE_VERSION}_amd64.deb \ + && rm code-server_${CODE_VERSION}_amd64.deb + +RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \ + && git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \ + && git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \ + && git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k \ + && sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' /root/.zshrc \ + && sed -i 's/plugins=(.*)/plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)/' /root/.zshrc \ + && chsh -s /bin/zsh root + +RUN git config --global core.quotepath false \ + && git config --global user.email "168062547@qq.com" \ + && git config --global user.name "amass" + +RUN mkdir /var/run/sshd \ + && sed -i 's/#Port 22/Port 1022/' /etc/ssh/sshd_config \ + && sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config \ + && mkdir -p /root/.ssh \ + && wget https://frp-by1.wwvvww.cn:44048/s/id_ed25519/download -O /root/.ssh/authorized_keys \ + && chmod 600 /root/.ssh/authorized_keys && chown root:root /root/.ssh/authorized_keys + +EXPOSE 1022 + +RUN cd /root \ + && apt update \ + && apt install -y libgl1-mesa-dev libfontconfig1-dev libfreetype-dev libx11-dev libx11-xcb-dev libxext-dev libxfixes-dev libxi-dev libxrender-dev libxcb1-dev libxcb-cursor-dev libxcb-glx0-dev libxcb-keysyms1-dev libxcb-image0-dev libxcb-shm0-dev libxcb-icccm4-dev libxcb-sync-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-util-dev libxcb-xinerama0-dev libxcb-xkb-dev libxkbcommon-dev libxkbcommon-x11-dev \ + && apt install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libavfilter-dev libavdevice-dev \ + && apt clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && wget https://download.qt.io/official_releases/qt/6.8/6.8.0/single/qt-everywhere-src-6.8.0.tar.xz \ + && tar -xvf qt-everywhere-src-6.8.0.tar.xz \ + && cd ./qt-everywhere-src-6.8.0 \ + && ./configure -prefix /opt/Qt/6.8.0/gcc_64 -opensource -debug-and-release -confirm-license -nomake examples -nomake tests -skip qtwebengine -skip qtcoap -skip qtopcua \ + && cmake --build . --parallel \ + && ninja install \ + && rm -fr /root/qt-everywhere-src-6.8.0* \ + && echo 'export PATH=/opt/Qt/6.8.0/gcc_64/bin:$PATH' >> /etc/zsh/zshenv \ + && echo 'export PATH=/opt/Qt/6.8.0/gcc_64/bin:$PATH' >> /etc/profile + +RUN cd /root \ + && wget https://frp-by1.wwvvww.cn:44048/s/boost_1_86_0/download -O boost_1_86_0.tar.gz \ + && tar xvf boost_1_86_0.tar.gz > /dev/null \ + && cd /root/boost_1_86_0 \ + && ./bootstrap.sh --prefix=/opt/Libraries/boost_1_86_0 \ + && ./b2 install -q --prefix=/opt/Libraries/boost_1_86_0 threading=multi link=shared runtime-link=shared variant=release cxxstd=17 cxxflags=-fPIC cflags=-fPIC \ + && rm -fr /root/boost_1_86_0* \ + && echo 'export LD_LIBRARY_PATH=/opt/Libraries/boost_1_86_0/lib:$LD_LIBRARY_PATH' >> /etc/zsh/zshenv \ + && echo 'export LD_LIBRARY_PATH=/opt/Libraries/boost_1_86_0/lib:$LD_LIBRARY_PATH' >> /etc/profile + +RUN cd /root \ + && wget https://github.com/Mbed-TLS/mbedtls/releases/download/mbedtls-3.6.2/mbedtls-3.6.2.tar.bz2 \ + && tar xvf mbedtls-3.6.2.tar.bz2 \ + && cd /root/mbedtls-3.6.2 \ + && cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/Libraries/mbedtls-3.6.2 \ + && cmake --build build --target all \ + && cmake --install build \ + && rm -fr /root/mbedtls-3.6.2* + +RUN cd /root \ + && wget https://github.com/nanomsg/nng/archive/refs/tags/v1.9.0.tar.gz -O nng-1.9.0.tar.gz \ + && tar xvf nng-1.9.0.tar.gz \ + && cd /root/nng-1.9.0 \ + && sed -i 's/# PATH_SUFFIXES lib/PATH_SUFFIXES lib/' cmake/FindMbedTLS.cmake \ + && sed -i '/_MBEDTLS_LIBRARY/{n;n;n;n;s/#PATH_SUFFIXES lib/PATH_SUFFIXES lib/}' cmake/FindMbedTLS.cmake \ + && cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/Libraries/nng-1.9.0 -DNNG_ELIDE_DEPRECATED=ON -DNNG_ENABLE_TLS=ON -DMBEDTLS_ROOT=/opt/Libraries/mbedtls-3.6.2 -D_MBEDTLS_V2_OR_NEWER=ON \ + && cmake --build build --target all \ + && cmake --install build \ + && rm -fr /root/nng-1.9.0* + +RUN cd /root \ + && wget https://github.com/emweb/wt/archive/4.11.0.tar.gz -O wt-4.11.0.tar.gz \ + && tar xvf wt-4.11.0.tar.gz \ + && cd /root/wt-4.11.0 \ + && cmake -G Ninja -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/Libraries/wt-4.11.0 -DENABLE_QT4=OFF -DENABLE_QT5=OFF -DENABLE_QT6=OFF -DBOOST_ROOT=/opt/Libraries/boost_1_86_0 \ + && cmake --build build --target all \ + && cmake --install build \ + && rm -fr /root/wt-4.11.0* + +RUN cd /root \ + && git clone --depth=1 --recursive https://github.com/ZLMediaKit/ZLMediaKit.git \ + && cd /root/ZLMediaKit \ + && apt update \ + && apt install -y libsrtp2-dev libusrsctp-dev \ + && apt clean \ + && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && cmake -G Ninja -B build -S . -DENABLE_OPENSSL=true -DENABLE_WEBRTC=true -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/Libraries/ZLMediaKit" \ + && cmake --build build --target all \ + && cmake --install build \ + && echo 'export LD_LIBRARY_PATH=/opt/Libraries/ZLMediaKit/lib:$LD_LIBRARY_PATH' >> /etc/zsh/zshenv \ + && echo 'export LD_LIBRARY_PATH=/opt/Libraries/ZLMediaKit/lib:$LD_LIBRARY_PATH' >> /etc/profile \ + && rm -fr /root/ZLMediaKit + +ENV LD_LIBRARY_PATH=/opt/Libraries/boost_1_86_0/lib:/opt/Libraries/ZLMediaKit/lib:/opt/Qt/6.8.0/gcc_64/lib + +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 +ENV TERM=xterm-256color + +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["bash", "-c", "service ssh start && code-server --bind-addr 0.0.0.0:8087"] + +# docker build --progress=tty -f ubuntu2404.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04 . +# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04 \ No newline at end of file diff --git a/Dockerfiles/ubuntu2404_pure.dockerfile b/Dockerfiles/ubuntu2404_pure.dockerfile new file mode 100644 index 0000000..736d55d --- /dev/null +++ b/Dockerfiles/ubuntu2404_pure.dockerfile @@ -0,0 +1,28 @@ +FROM ubuntu:24.04 +LABEL maintainer="amass <168062547@qq.com>" +ENV DEBIAN_FRONTEND=noninteractive + +RUN sed -i 's@//.*archive.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list.d/ubuntu.sources \ + && apt update \ + && apt install -y tini openssh-server + +RUN mkdir /var/run/sshd \ + && sed -i 's/#Port 22/Port 5022/' /etc/ssh/sshd_config \ + && sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config \ + && mkdir -p /root/.ssh \ + && wget https://frp-by1.wwvvww.cn:44048/s/id_ed25519/download -O /root/.ssh/authorized_keys \ + && chmod 600 /root/.ssh/authorized_keys && chown root:root /root/.ssh/authorized_keys + +EXPOSE 5022 + + +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 +ENV TERM=xterm-256color + +ENTRYPOINT ["/usr/bin/tini", "--"] +CMD ["service", "ssh", "start", "-D"] + +# docker build --progress=tty -f ubuntu2404_pure.dockerfile -t frp-by1.wwvvww.cn:45288/ubuntu_pure:24.04 . +# docker push frp-by1.wwvvww.cn:45288/ubuntu_dev:24.04 +# docker run -it -d --rm --network host --name develop frp-by1.wwvvww.cn:45288/ubuntu_pure:24.04 \ No newline at end of file diff --git a/Dockerfiles/wwooww_frpc.dockerfile b/Dockerfiles/wwooww_frpc.dockerfile new file mode 100644 index 0000000..50f67c4 --- /dev/null +++ b/Dockerfiles/wwooww_frpc.dockerfile @@ -0,0 +1,30 @@ +FROM amd64/alpine:3.18 + +LABEL maintainer="amass <168062547@qq.com>" + +ENV FRP_VERSION 0.49.0 + +RUN apk add openssl curl ca-certificates \ + && wget 'http://openresty.org/package/admin@openresty.com-5ea678a6.rsa.pub' \ + && mv 'admin@openresty.com-5ea678a6.rsa.pub' /etc/apk/keys/ \ + && . /etc/os-release \ + && MAJOR_VER=`echo $VERSION_ID | sed 's/\.[0-9]\+$//'` \ + && echo "http://openresty.org/package/alpine/v$MAJOR_VER/main" | tee -a /etc/apk/repositories \ + && apk update \ + && apk add openresty openresty-resty openresty-opm \ + && opm get bungle/lua-resty-session + +RUN cd /root \ + && wget --no-check-certificate -c https://github.com/fatedier/frp/releases/download/v${FRP_VERSION}/frp_${FRP_VERSION}_linux_amd64.tar.gz \ + && tar zxvf frp_${FRP_VERSION}_linux_amd64.tar.gz \ + && cd frp_${FRP_VERSION}_linux_amd64/ \ + && cp frpc /usr/bin/ \ + && mkdir -p /etc/frp \ + && cp frpc.ini /etc/frp \ + && cd /root \ + && rm frp_${FRP_VERSION}_linux_amd64.tar.gz \ + && rm -rf frp_${FRP_VERSION}_linux_amd64/ + +ENTRYPOINT if [ -d /app ]; then cd /app && openresty -p /app; fi; /usr/bin/frpc -c /etc/frp/frpc.ini + +# docker build --progress=tty -f wwooww_frpc.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/frpc:0.49.0 . diff --git a/Dockerfiles/yoctools.dockerfile b/Dockerfiles/yoctools.dockerfile new file mode 100644 index 0000000..2df751a --- /dev/null +++ b/Dockerfiles/yoctools.dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:22.04 +LABEL maintainer="amass <168062547@qq.com>" +ENV DEBIAN_FRONTEND=noninteractive + +RUN sed -i "s@http://.*archive.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list \ + && sed -i "s@http://.*security.ubuntu.com@http://mirrors.tuna.tsinghua.edu.cn@g" /etc/apt/sources.list \ + && apt update \ + && apt install -y git lz4 unzip python3-pip + +RUN pip3 install yoctools pyyaml && cd /usr/bin && ln -s python3 python + + +RUN git config --global core.quotepath false \ + && git config --global user.email "168062547@qq.com" \ + && git config --global user.name "amass" + + +CMD ["service", "ssh", "start", "-D"] + +ENV LANG=C.UTF-8 +ENV LC_ALL=C.UTF-8 +ENV TERM=xterm-256color + +# docker build --progress=tty -f yoctools.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/yoctools:22.04 . \ No newline at end of file diff --git a/resource/act_runner.sh b/resource/act_runner.sh new file mode 100755 index 0000000..ca14dc1 --- /dev/null +++ b/resource/act_runner.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +if [[ ! -d /data ]]; then + mkdir -p /data +fi + +cd /data + +RUNNER_STATE_FILE=${RUNNER_STATE_FILE:-'.runner'} + +CONFIG_ARG="" +if [[ ! -z "${CONFIG_FILE}" ]]; then + CONFIG_ARG="--config ${CONFIG_FILE}" +fi +EXTRA_ARGS="" +if [[ ! -z "${GITEA_RUNNER_LABELS}" ]]; then + EXTRA_ARGS="${EXTRA_ARGS} --labels ${GITEA_RUNNER_LABELS}" +fi + +# In case no token is set, it's possible to read the token from a file, i.e. a Docker Secret +if [[ -z "${GITEA_RUNNER_REGISTRATION_TOKEN}" ]] && [[ -f "${GITEA_RUNNER_REGISTRATION_TOKEN_FILE}" ]]; then + GITEA_RUNNER_REGISTRATION_TOKEN=$(cat "${GITEA_RUNNER_REGISTRATION_TOKEN_FILE}") +fi + +# Use the same ENV variable names as https://github.com/vegardit/docker-gitea-act-runner +test -f "$RUNNER_STATE_FILE" || echo "$RUNNER_STATE_FILE is missing or not a regular file" + +if [[ ! -s "$RUNNER_STATE_FILE" ]]; then + try=$((try + 1)) + success=0 + + # The point of this loop is to make it simple, when running both act_runner and gitea in docker, + # for the act_runner to wait a moment for gitea to become available before erroring out. Within + # the context of a single docker-compose, something similar could be done via healthchecks, but + # this is more flexible. + while [[ $success -eq 0 ]] && [[ $try -lt ${GITEA_MAX_REG_ATTEMPTS:-10} ]]; do + act_runner register \ + --instance "${GITEA_INSTANCE_URL}" \ + --token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \ + --name "${GITEA_RUNNER_NAME:-`hostname`}" \ + ${CONFIG_ARG} ${EXTRA_ARGS} --no-interactive 2>&1 | tee /tmp/reg.log + + cat /tmp/reg.log | grep 'Runner registered successfully' > /dev/null + if [[ $? -eq 0 ]]; then + echo "SUCCESS" + success=1 + else + echo "Waiting to retry ..." + sleep 5 + fi + done +fi +# Prevent reading the token from the act_runner process +unset GITEA_RUNNER_REGISTRATION_TOKEN +unset GITEA_RUNNER_REGISTRATION_TOKEN_FILE + +act_runner daemon ${CONFIG_ARG} diff --git a/resource/build.sh b/resource/build.sh index ce8c096..982c6f9 100755 --- a/resource/build.sh +++ b/resource/build.sh @@ -54,6 +54,35 @@ function init() { scp -r /opt/Libraries/boost_1_85_0 root@amass.fun:/opt/Libraries/ } +function build_docker_images(){ + local DOCKERFILE=$1 + echo "build $DOCKERFILE" + if [[ $DOCKERFILE == *"act_runner.dockerfile" ]]; then + ACT_RUNNER_VERSION=$(grep 'ENV ACT_VERSION' act_runner.dockerfile | awk '{print $3}') + docker build --progress=plain -f $DOCKERFILE -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/act_runner:$ACT_RUNNER_VERSION . + docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/act_runner:$ACT_RUNNER_VERSION + elif [[ $DOCKERFILE == *"nanopb.dockerfile" ]]; then + docker build --progress=plain -f $DOCKERFILE -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/nanopb:0.3.9.3 . + docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/nanopb:0.3.9.3 + elif [[ $DOCKERFILE == *"ubuntu2404.dockerfile" ]]; then + docker build --progress=plain -f $DOCKERFILE -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04 . + docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04 + elif [[ $DOCKERFILE == *"ubuntu2204.dockerfile" ]]; then + docker build --progress=plain -f $DOCKERFILE -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:22.04 . + docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:22.04 + elif [[ $DOCKERFILE == *"ubuntu1604.dockerfile" ]]; then + docker build --progress=plain -f $DOCKERFILE -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:16.04 . + docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:16.04 + elif [[ $DOCKERFILE == *"frpc.dockerfile" ]]; then + FRP_VERSION=$(grep 'ENV FRP_VERSION' $DOCKERFILE | awk '{print $3}') + docker build --progress=plain -f $DOCKERFILE -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/frpc:$FRP_VERSION . + docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/frpc:$FRP_VERSION + else + echo "not found steps for build $DOCKERFILE ..." + fi +} + + function main() { local cmd=$1 shift 1 @@ -64,6 +93,9 @@ function main() { build) build ;; + docker) + build_docker_images + ;; *) build ;;