Docker build changes

This commit is contained in:
Ben Sarmiento
2023-11-21 10:52:52 +01:00
parent f2922ea7b4
commit 6ae18fba36

View File

@@ -6,11 +6,6 @@ on:
- main - main
tags: tags:
- v0* - v0*
- latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-testing
jobs: jobs:
build-and-push-image: build-and-push-image:
@@ -37,7 +32,7 @@ jobs:
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@v3 uses: docker/login-action@v3
with: with:
registry: ${{ env.REGISTRY }} registry: ghcr.io
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
@@ -45,7 +40,7 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v5 uses: docker/metadata-action@v5
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
@@ -57,3 +52,22 @@ jobs:
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
- name: Extract metadata (tags, labels) for Docker
if: startsWith(github.ref, 'refs/tags/v0')
id: publicmeta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-testing
- name: Build and push Docker image
if: startsWith(github.ref, 'refs/tags/v0')
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.publicmeta.outputs.tags }}
labels: ${{ steps.publicmeta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache