diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index d03ebaa..0000000 --- a/.drone.yml +++ /dev/null @@ -1,43 +0,0 @@ -kind: pipeline -type: docker -name: docker-build -steps: - - name: deploy-mkdocs - image: plugins/docker - settings: - registry: registry.cn-shenzhen.aliyuncs.com - repo: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop - tags: mkdocs - dockerfile: mkdocs.dockerfile - username: 168062547@qq.com - password: - from_secret: docker_password - - name: deploy-ubuntu2004 - image: plugins/docker - settings: - registry: registry.cn-shenzhen.aliyuncs.com - repo: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop - tags: ubuntu2004 - dockerfile: ubuntu2004.dockerfile - username: 168062547@qq.com - password: - from_secret: docker_password - - name: deploy-raspberrypi - image: plugins/docker - settings: - registry: registry.cn-shenzhen.aliyuncs.com - repo: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop - tags: raspberrypi - dockerfile: raspberrypi.dockerfile - username: 168062547@qq.com - password: - from_secret: docker_password - - name: notify - image: registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop:20.04 - when: - status: - - failure - - success - commands: - - >- - cat resources/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/act_runner.dockerfile b/act_runner.dockerfile new file mode 100644 index 0000000..7ea8a89 --- /dev/null +++ b/act_runner.dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:22.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 \ + && apt update \ + && apt install -y ca-certificates curl git tini \ + && curl https://gitea.com/gitea/act_runner/releases/download/v0.2.6/act_runner-0.2.6-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 \ + && apt update \ + && apt install -y docker-ce-cli + +COPY resources/act_runner.sh /opt/act/run.sh + +ENTRYPOINT ["tini","--","/opt/act/run.sh"] \ No newline at end of file diff --git a/mkdocs.dockerfile b/mkdocs.dockerfile deleted file mode 100644 index 1958d1a..0000000 --- a/mkdocs.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM ubuntu:22.04 -LABEL maintainer 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 -RUN apt-get install -y --no-install-recommends vim python3 pip -RUN pip install mkdocs mkdocs-material mkdocs-encryptcontent-plugin mdx_truly_sane_lists -i https://pypi.tuna.tsinghua.edu.cn/simple - - -# docker build -f mkdocs.dockerfile -t mkdocs . \ No newline at end of file diff --git a/resources/act_runner.sh b/resources/act_runner.sh new file mode 100755 index 0000000..ca14dc1 --- /dev/null +++ b/resources/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/ubuntu2004.dockerfile b/ubuntu2004.dockerfile deleted file mode 100644 index 97c983d..0000000 --- a/ubuntu2004.dockerfile +++ /dev/null @@ -1,65 +0,0 @@ -FROM ubuntu:20.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 && \ - apt-get update && \ - apt-get install -y software-properties-common curl wget jq gettext git ninja-build pkg-config \ - libssl-dev libcurl4-openssl-dev libffmpeg-ocaml-dev libfreetype-dev libalsa-ocaml-dev \ - liblzma-dev libx264-dev - -RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \ - apt-get install -y locate gcc-11 g++-11 && \ - updatedb && ldconfig && \ - update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 && \ - update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 110 - -WORKDIR /home/temp -RUN wget https://github.com/Kitware/CMake/releases/download/v3.25.0/cmake-3.25.0-linux-x86_64.tar.gz && \ - wget https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz && \ - wget https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz && \ - wget https://github.com/tfussell/xlnt/archive/refs/tags/v1.5.0.tar.gz -O xlnt-1.5.0.tar.gz - -RUN tar xvf cmake-3.25.0-linux-x86_64.tar.gz -C /opt && \ - tar xvf boost_1_81_0.tar.gz && \ - tar xvf zeromq-4.3.4.tar.gz && \ - tar xvf xlnt-1.5.0.tar.gz -ENV PATH="${PATH}:/opt/cmake-3.25.0-linux-x86_64/bin" - -WORKDIR /home/temp/boost_1_81_0 -RUN ./bootstrap.sh --prefix=/opt/Libraries/boost_1_81_0 -RUN ./b2 install -q --prefix=/opt/Libraries/boost_1_81_0 threading=multi link=shared runtime-link=shared variant=release cxxstd=17 cxxflags=-fPIC cflags=-fPIC -ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/opt/Libraries/boost_1_81_0/lib" - -WORKDIR /home/temp/zeromq-4.3.4/build -RUN cmake \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_INSTALL_PREFIX=/opt/Libraries/zeromq-4.3.4_debug \ - .. -RUN ninja install -RUN rm -fr ./* -RUN cmake \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/opt/Libraries/zeromq-4.3.4_release \ - .. -RUN ninja install - -WORKDIR /home/temp/xlnt-1.5.0/build -RUN sed -i '1s/^/#include \n/' ../source/detail/number_format/number_formatter.cpp && \ - cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug \ - -DCMAKE_INSTALL_PREFIX=/opt/Libraries/xlnt-1.5.0_debug .. && \ - ninja install && rm -fr ./* && \ - cmake -G Ninja -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/opt/Libraries/xlnt-1.5.0_release .. && \ - ninja install && \ - bash -c "sed -i -e 's/set_and_check(XLNT_INCLUDE_DIR \"include\")/# set_and_check(XLNT_INCLUDE_DIR \"include\")/g' /opt/Libraries/xlnt-1.5.0_debug/lib/cmake/xlnt/XlntConfig.cmake &&\ - sed -i -e 's/set_and_check(XLNT_INCLUDE_DIR \"include\")/# set_and_check(XLNT_INCLUDE_DIR \"include\")/g' /opt/Libraries/xlnt-1.5.0_release/lib/cmake/xlnt/XlntConfig.cmake" -WORKDIR / -RUN rm -fr /home/temp -ENV LANG C.UTF-8 - -# docker build -f ubuntu2004.dockerfile -t develop:20.04 . -# docker login --username=168062547@qq.com registry.cn-shenzhen.aliyuncs.com -# docker tag develop:20.04 registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop:20.04 -# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/develop:20.04 \ No newline at end of file