Update Docker workflow to log in to GitHub Container Registry and build multi-architecture images with metadata extraction
This commit is contained in:
29
.github/workflows/docker-image-linux.yml
vendored
29
.github/workflows/docker-image-linux.yml
vendored
@@ -22,33 +22,30 @@ jobs:
|
|||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push amd64
|
- name: Extract metadata for Docker
|
||||||
uses: docker/build-push-action@v6
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
images: ${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}
|
||||||
file: ./Dockerfile
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
build-args: |
|
|
||||||
ARCH=x86_64
|
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:latest
|
type=raw,value=latest
|
||||||
|
type=sha,format=short
|
||||||
|
|
||||||
- name: Build and push arm64
|
- name: Build and push both architectures
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
platforms: linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
build-args: |
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
ARCH=aarch64
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
tags: |
|
cache-from: type=gha
|
||||||
${{ env.REGISTRY }}/${{ env.GITHUBUSER }}/${{ env.IMAGE_NAME }}:latest
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
Reference in New Issue
Block a user