Skip to content

Commit fb32358

Browse files
committed
gh action docker build optimizations
1 parent e7b11a9 commit fb32358

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,44 @@
11
name: Docker
2-
32
on:
43
push:
5-
branches: [ "main" ]
4+
branches: ["main"]
65
# Publish semver tags as releases.
7-
tags: [ 'v*.*.*' ]
6+
tags: ['v*.*.*']
87
pull_request:
9-
branches: [ "main" ]
10-
8+
branches: ["main"]
119
env:
1210
REGISTRY: ghcr.io
1311
IMAGE_NAME: ${{ github.repository }}
14-
1512
jobs:
1613
build-and-push-image:
1714
runs-on: ubuntu-latest
1815
permissions:
1916
contents: read
2017
packages: write
21-
2218
steps:
2319
- name: Checkout repository
2420
uses: actions/checkout@v3
25-
26-
- name: Setup Docker buildx
27-
uses: docker/setup-buildx-action@v2.4.1
28-
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
2923
- name: Log into registry ${{ env.REGISTRY }}
3024
if: github.event_name != 'pull_request'
3125
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
3226
with:
3327
registry: ${{ env.REGISTRY }}
3428
username: ${{ github.actor }}
3529
password: ${{ secrets.GITHUB_TOKEN }}
36-
3730
- name: Extract metadata (tags, labels) for Docker
3831
id: meta
3932
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
4033
with:
4134
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42-
4335
- name: Build and push Docker image
44-
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
36+
uses: docker/build-push-action@v6
4537
with:
4638
context: .
4739
platforms: linux/amd64,linux/arm64
4840
push: ${{ github.event_name != 'pull_request' }}
4941
tags: ${{ steps.meta.outputs.tags }}
5042
labels: ${{ steps.meta.outputs.labels }}
43+
cache-from: type=gha
44+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)