name: Automated Container Build

on:
  push:
    branches:
      - main

jobs:
  build-and-push:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Log into Local Registry
        uses: docker/login-action@v3
        with:
          registry: 172.17.0.1:3030
          username: ${{ gitea.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and Push Image
        uses: docker/build-push-action@v5
        with:
          context: .
          push: true
          tags: 172.17.0.1:3030/${{ gitea.actor }}/${{ github.event.repository.name }}:latest