add layer caching, build args

This commit is contained in:
Jussi Räsänen 2024-05-19 16:36:41 +03:00
parent 2caf947ab4
commit 1275ba1e23
No known key found for this signature in database
GPG key ID: 973AC6ACBE3D307D
2 changed files with 15 additions and 23 deletions

View file

@ -15,6 +15,7 @@ concurrency:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
WRITEFREELY_VERSION: v0.15.0
jobs:
build:
@ -37,13 +38,14 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get metadata
id: meta
uses: docker/metadata-action@v5
- uses: actions/cache@v3
with:
images: |
jrasanen/writefreely
ghcr.io/${{ github.repository }}
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build and Push
uses: docker/build-push-action@v5
@ -52,5 +54,11 @@ jobs:
file: ./Dockerfile
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
WRITEFREELY_VERSION=${{ env.WRITEFREELY_VERSION }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ env.WRITEFREELY_VERSION }}
${{ env.DOCKERHUB_REPO }}:latest
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max