cache docker build and add full tag (#125)

* cache docker build

* fix tag

* remove pr test
This commit is contained in:
Boshi Lian 2023-01-06 05:47:44 -08:00 committed by GitHub
parent 20be820e02
commit c33a9f2255
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 3 deletions

View file

@ -6,6 +6,8 @@ name: Docker
# documentation.
on:
push:
branches: [ master ]
release:
types: [ released ]
@ -23,7 +25,7 @@ jobs:
ref: ${{ github.event.workflow_run.head_sha }}
fetch-depth: 0
submodules: 'recursive'
- uses: dotnet/nbgv@master
with:
setAllVars: true
@ -64,6 +66,19 @@ jobs:
flavor: |
latest=true
- name: Extract Docker full metadata
id: metafull
uses: docker/metadata-action@v4
with:
images: |
farmer1992/sshpiperd
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=v${{ env.NBGV_SimpleVersion }}
flavor: |
latest=auto
prefix=full-
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
@ -72,6 +87,22 @@ jobs:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: VER=${{ env.NBGV_SimpleVersion }}
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push full Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
build-args: |
- VER=${{ env.NBGV_SimpleVersion }}
- BUILDTAGS=full
push: ${{ github.event_name == 'release' }}
tags: ${{ steps.metafull.outputs.tags }}
labels: ${{ steps.metafull.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

View file

@ -23,7 +23,6 @@ jobs:
with:
go-version: ^1.19
cache: true
id: go
- uses: dotnet/nbgv@master
with: