From d435aed22c487a93825c53cf34e5b1686da0819e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A2=B3=E9=BB=91=E6=A9=99=E5=AD=90?= <96968141+HChenZi@users.noreply.github.com> Date: Tue, 12 Sep 2023 07:34:32 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=94=AF=E6=8C=81docker=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 40 +++++++++++++++++++++++++++++++++++++ Dockerfile | 19 ++++++++++++++++++ README.md | 6 +++++- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build.yml create mode 100644 Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9e04c89 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,40 @@ +name: Docker Hub Release + +on: + push: + branches: [main] + +jobs: + docker: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Docker + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Generate Tags + uses: docker/metadata-action@v4 + id: metadata + with: + images: | + ${{ secrets.DOCKERHUB_USERNAME }}/senkongdao + tags: | + type=raw,value=latest + + - name: Build and Publish + uses: docker/build-push-action@v4 + with: + context: . + file: Dockerfile + push: true + tags: ${{ steps.metadata.outputs.tags }} + labels: ${{ steps.metadata.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d709f98 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +# Build Stage +FROM python:3.9 as build +WORKDIR /usr/app +RUN python -m venv /usr/app/venv +ENV PATH="/usr/app/venv/bin:$PATH" + +COPY requirements.txt . +RUN pip install -r requirements.txt + +# Final Deployment Stage +FROM python:3.9-slim + +WORKDIR /app +COPY --from=build /usr/app/venv . +COPY . . + +ENV PATH="/app/bin:$PATH" + +CMD ["python", "SenKongDao.py"] diff --git a/README.md b/README.md index 1309ad4..122a9fd 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,12 @@ > > 5. 控制台返回的一串长度为32的数字字母组合字符串即为所需Cred字段 > -支持多账号,每行一个账号即可 +支持多账号,每行一个账号即可 以下为某个账户的实例: xxxxxx&yyyyyyyyyy + +### 或使用 docker 运行 + 1. 参考上面教程新建 `SenKongDao_config.txt` 文件,填入 `uid` 以及 `cred` 字段 + 2. 运行 `docker run -v ./SenKongDao_config.txt:/app/SenKongDao_config.txt cblackorange/senkongdao` 其中 `./SenKongDao_config.txt` 为配置文件路径,可自行修改