From 5644f564eb3581aa20c0474ab6a3cc0e0be8328c Mon Sep 17 00:00:00 2001 From: "nate@necloud.us" Date: Wed, 13 Aug 2025 11:35:09 -0400 Subject: [PATCH] Add Docker build and push GitHub Actions workflow --- .github/workflows/docker-build-push.yml | 42 +++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docker-build-push.yml diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml new file mode 100644 index 0000000..7860c87 --- /dev/null +++ b/.github/workflows/docker-build-push.yml @@ -0,0 +1,42 @@ +name: Docker Build and Push + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Extract version from tag + id: get_version + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }} + cache-from: type=gha + cache-to: type=gha,mode=max