name: Build and Push Docker Image
run-name: ${{ gitea.actor }}
on:
  push:
    branches:
      - main

jobs:
  BuildAndPush:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Set docker chmod (temp solution)
        run: sudo chmod 666 /var/run/docker.sock

      - name: Docker - Login
        uses: docker/login-action@v1
        with:
          registry: git.hashdot.co
          username: ${{ secrets.DOCKER_USER }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Use Bun
        uses: oven-sh/setup-bun@v2
        with:
          bun-version: 1.1.21

      - name: Install dependencies
        run: bun install

      - name: Build
        run: bun run build

      - name: Build Docker Image
        run: bun run docker:build

      - name: Push Docker Image
        run: bun run docker:push
