name: Build and Deploy Gabriel Kaszewski Portfolio

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build-and-deploy-local:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3

      - name: Rebuild and Deploy with Docker Compose
        run: |
          docker build --target release -t local/gabriel-portfolio:latest .
          docker compose up -d

          # Clean up any old, unused images to save disk space
          docker image prune -f