Skip to content

feat: 更新docker-build.yml,支持多平台构建 #10

feat: 更新docker-build.yml,支持多平台构建

feat: 更新docker-build.yml,支持多平台构建 #10

Workflow file for this run

name: Build and Push PostgreSQL 16 Image
on:
push:
branches: [ v16 ]
pull_request:
branches: [ v16 ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: riccoxie/postgres-zh
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,format=short
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/386,linux/amd64,linux/arm/v7,linux/arm/v5,linux/arm64,linux/ppc64le,linux/s390x
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max