diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index c464b17..9d4b4eb 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -3,13 +3,16 @@ name: Docker Image on: push: branches: ['master'] + create: env: REGISTRY: ghcr.io - IMAGE_NAME: rahb-realtors-association/email-autoread + IMAGE_NAME: rahb-realtors-association/email-autoread # Replace with your lowercase repository name jobs: build-and-push-image: + # The job runs if the event was a push to master or a created tag. + if: github.event_name == 'push' || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags/')) runs-on: ubuntu-latest permissions: contents: read @@ -31,6 +34,12 @@ jobs: uses: docker/metadata-action@v4 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + # Use the Git reference (branch or tag) as the Docker tag. + tags: | + type=ref,event=tag + type=semver,pattern={{version}} + type=sha,format=long + type=raw,value=latest,enable=${{ github.event_name == 'push' }} - name: Build and push Docker image uses: docker/build-push-action@v4 diff --git a/README.md b/README.md index a4d33aa..0c830ca 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,23 @@ # Email AntAI-Spam -Email Auto-reader is a Python tool that uses AI to automatically mark as read any unread Gmail messages that are likely to be junk, and optionally apply a label to them. This streamlines email management tasks by reducing the amount of junk mail you need to manually filter. It can use either a local AI model or the OpenAI API based on your configuration. +Email AntAI-Spam is a Python tool that uses AI to automatically mark as read any unread Gmail messages that are likely to be junk, and optionally apply a label to them. This streamlines email management tasks by reducing the amount of junk mail you need to manually filter. It can use either a local AI model or the OpenAI API based on your configuration. ## Running with Docker To get started, you first need to pull the Docker image from the GitHub Container Registry. You can do this by running the following command in your terminal: ```bash -docker pull ghcr.io/rahb-realtors-association/email-autoread:master +docker pull ghcr.io/rahb-realtors-association/email-autoread:latest ``` You need to provide your OpenAI API key and specify whether you want to use a local AI model or the OpenAI API. You also need to bind mount your `settings.json` file into the Docker container. You can do this by running the following command: ```bash -docker run -e OPENAI_API_KEY= -e USE_LOCAL= -v /path/to/your/settings.json:/app/settings.json ghcr.io/rahb-realtors-association/email-autoread:master +docker run -e OPENAI_API_KEY= -v /path/to/your/settings.json:/app/settings.json -v /path/to/your/credentials.json:/app/credentials.json -v /path/to/your/tocken.pickle:/app/token.pickle ghcr.io/rahb-realtors-association/email-autoread:latest ``` -Please replace `` with your actual OpenAI API key, `` with `true` if you want to use a local AI model or `false` if you want to use the OpenAI API, and `/path/to/your/settings.json` with the actual path to your `settings.json` file on your host system. - -With this, the project should be up and running inside a Docker container on your system! +Please replace `` with your actual OpenAI API key, `/path/to/your/settings.json` with the actual path to your `settings.json` file on your host system, and the same for `credentials.json` and `token.pickle`. ## Manual Setup