diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..87912f4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,32 @@ +name: Build and Push Docker image + +on: + push: + branches: + - main + release: + types: [ published ] + +env: + IMAGE_NAME: hmnd-tellr + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}, ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest diff --git a/README.md b/README.md index 3dfcc71..4ded424 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,16 @@ docker compose build docker compose up ``` +# GitHub CI Workflow + +This project uses GitHub CI workflow for automatic Docker image building and pushing to Docker Hub. The workflow is triggered on every push to the main branch and on every new published release. + +To use this workflow, you need to have your Docker Hub username and token stored in your GitHub repository secrets. These secrets should be named DOCKERHUB_USERNAME and DOCKERHUB_TOKEN respectively. + +To set these secrets, go to the "Settings" tab of your repository, select "Secrets" from the left sidebar, and click on "New repository secret". + +Once these secrets are set, every time you push to the main branch, GitHub Actions will build a new Docker image and push it to your Docker Hub repository. + ## Usage Access the status report by URL. Use `AUTH` as set in `.env` within the URL.