From 7584e161e92a1b0ef3fc87924d1585a77a455d66 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 11 Feb 2023 18:26:49 +0800 Subject: [PATCH] Update --- .github/workflows/docker.yml | 17 +++++++++++----- Dockerfile | 38 ------------------------------------ 2 files changed, 12 insertions(+), 43 deletions(-) delete mode 100644 Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 59cbc23..9b14b5d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,9 +3,12 @@ name: "Docker Build" # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch - workflow_dispatch: ~ - push: - branches: [ main ] + workflow_dispatch: + inputs: + tags: + description: 'main version tag, example: v3' + required: true + default: 'v3' jobs: build: @@ -16,6 +19,7 @@ jobs: DOCKER_CLI_EXPERIMENTAL: enabled DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKERHUB_REPOSITORY: ${{ secrets.DOCKER_REPO }} + DOCKER_TAG: ${{ github.event.inputs.tags }} steps: - name: Checkout uses: actions/checkout@v2 @@ -36,6 +40,10 @@ jobs: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx + - name: Download Dockerfile + run: | + wget -O Dockerfile https://raw.githubusercontent.com/luoshuijs/TGPaimonBot/main/Dockerfile + - name: Build run: | docker buildx build \ @@ -43,7 +51,6 @@ jobs: --cache-to "type=local,dest=/tmp/.buildx-cache" \ --output "type=image,push=true" \ --platform "linux/amd64,linux/arm64/v8" \ - --build-arg "S6_ARCH=amd64" \ - --tag "${DOCKERHUB_REPOSITORY}:latest" \ + --tag "${DOCKERHUB_REPOSITORY}:${DOCKER_TAG}" \ -f Dockerfile \ . diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index adb1f5f..0000000 --- a/Dockerfile +++ /dev/null @@ -1,38 +0,0 @@ -FROM python:3.10.10-buster -ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \ - LANG=zh_CN.UTF-8 \ - SHELL=/bin/bash -SHELL ["/bin/bash", "-c"] -WORKDIR /app -RUN echo "deb http://ftp.us.debian.org/debian buster main non-free" >> /etc/apt/sources.list.d/fonts.list \ - && apt update \ - # clone - && apt install git wget curl -y \ - && git clone -b main https://github.com/luoshuijs/TGPaimonBot.git /app \ - # install dependencies \ - && pip install virtualenv poetry \ - && python3 -m virtualenv venv/ \ - && . venv/bin/activate \ - && poetry config virtualenvs.create false \ - && poetry source add --default mirrors https://pypi.tuna.tsinghua.edu.cn/simple/ \ - && poetry install \ - && poetry install --extras all \ - && playwright install chromium \ - && playwright install-deps chromium \ - ## set timezone - && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \ - && echo "Asia/Shanghai" > /etc/timezone \ - # create cache folder - && mkdir cache/ \ - # clean - && apt-get clean -y \ - && rm -rf \ - /tmp/* \ - /var/lib/apt/lists/* \ - /var/tmp/* \ - ~/.cache/pip \ - ~/.cache/pypoetry \ - # Add the wait script to the image - && wget -O /wait https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait \ - && chmod +x /wait -ENTRYPOINT /wait && venv/bin/alembic upgrade head && venv/bin/python run.py