diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..3c7bf8d --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -0,0 +1,50 @@ +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 + +jobs: + build: + runs-on: ubuntu-latest + name: docker build and publish + env: + DOCKER_BUILDKIT: 1 + DOCKER_CLI_EXPERIMENTAL: enabled + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKERHUB_REPOSITORY: ${{ vars.DOCKER_REPO }} + DOCKER_TAG: 'latest' + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Setup Docker Buildx + uses: crazy-max/ghaction-docker-buildx@v3 + + - name: Buildx cache + uses: actions/cache@v2 + id: buildx-cache + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx + + - name: Build + run: | + docker buildx build \ + --cache-from "type=local,src=/tmp/.buildx-cache" \ + --cache-to "type=local,dest=/tmp/.buildx-cache" \ + --output "type=image,push=true" \ + --platform "linux/amd64" \ + --tag "${DOCKERHUB_REPOSITORY}:${DOCKER_TAG}" \ + -f Dockerfile \ + . diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2fe7ece --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.12-slim +LABEL authors="xtaodada" + +WORKDIR /usr/app + +COPY requirements.txt . +RUN /bin/sh -c set -eux; apt-get update; apt-get install -y --no-install-recommends git ; rm -rf /var/lib/apt/lists/* # buildkit +RUN pip install -r requirements.txt + +COPY . . +CMD [ "python", "main.py" ] diff --git a/requirements.txt b/requirements.txt index a2e01a0..5b61ecb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,6 +11,6 @@ aiofiles==23.2.1 jinja2==3.1.3 beautifulsoup4 lxml -tgcrypto -pyrogram +PyroTgCrypto==1.2.6a0 +git+https://github.com/TeamPGM/pyrogram urlextract