1+ name : Build and Push Multi-arch postgres:latest
2+ on :
3+ push :
4+ branches :
5+ - ' main'
6+ paths :
7+ - ' .github/workflows/postgres-latest.yml'
8+
9+ jobs :
10+ build-multi-arch :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout repository
14+ uses : actions/checkout@v2
15+
16+ - name : Set up QEMU
17+ uses : docker/setup-qemu-action@v3
18+
19+ - name : Log in to GitHub Container Registry
20+ uses : docker/login-action@v3
21+ with :
22+ registry : ghcr.io
23+ username : ${{ github.repository_owner }}
24+ password : ${{ secrets.ACCESS_TOKEN }}
25+
26+ - name : Pull, tag and push amd64 image
27+ run : |
28+ docker pull --platform linux/amd64 postgres:latest
29+ docker tag postgres:latest ghcr.io/packages-mirror/postgres:latest-amd64
30+ docker push ghcr.io/packages-mirror/postgres:latest-amd64
31+
32+ - name : Pull, tag and push arm64 image
33+ run : |
34+ docker pull --platform linux/arm64 postgres:latest
35+ docker tag postgres:latest ghcr.io/packages-mirror/postgres:latest-arm64
36+ docker push ghcr.io/packages-mirror/postgres:latest-arm64
37+
38+ - name : Create and push manifest
39+ run : |
40+ docker manifest create ghcr.io/packages-mirror/postgres:latest \
41+ --amend ghcr.io/packages-mirror/postgres:latest-amd64 \
42+ --amend ghcr.io/packages-mirror/postgres:latest-arm64
43+
44+ docker manifest annotate ghcr.io/packages-mirror/postgres:latest \
45+ ghcr.io/packages-mirror/postgres:latest-amd64 \
46+ --arch amd64 --os linux
47+
48+ docker manifest annotate ghcr.io/packages-mirror/postgres:latest \
49+ ghcr.io/packages-mirror/postgres:latest-arm64 \
50+ --arch arm64 --os linux
51+
52+ docker manifest push ghcr.io/packages-mirror/postgres:latest
53+
54+ - name : Clean up
55+ run : |
56+ docker manifest rm ghcr.io/packages-mirror/postgres:latest
57+ docker image rm ghcr.io/packages-mirror/postgres:latest-amd64
58+ docker image rm ghcr.io/packages-mirror/postgres:latest-arm64
0 commit comments