From 9ad9d7cd29713223ce121eab4cdec65663523e1f Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sun, 29 Oct 2023 02:11:27 +0000 Subject: [PATCH] ci: simplify, update, and use docker layer caching --- .github/workflows/docker.yml | 38 ++++++++++++++---------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6489336..7bb904b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,5 +1,4 @@ name: Build and Push Docker Image - on: push: branches: @@ -8,26 +7,19 @@ on: jobs: docker: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and Push Docker Image - uses: docker/build-push-action@v2 - with: - context: . - file: ./dockerfile - platforms: linux/amd64 - push: true - tags: ghcr.io/${{ github.repository }}:latest + - uses: actions/checkout@v4 + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/setup-buildx-action@v3 + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64 + push: true + tags: ghcr.io/${{ github.repository }}:latest + cache-from: type=gha + cache-to: type=gha,mode=max