@@ -34,33 +34,31 @@ jobs:
3434 - name : Checkout
3535 uses : actions/checkout@v4
3636
37- - name : Docker meta
38- id : meta
39- uses : docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
40- with :
41- images : apache/answer
42- tags : |
43- type=ref,enable=true,priority=600,prefix=,suffix=,event=branch
44- type=semver,pattern={{version}}
45-
4637 - name : Set up QEMU
47- uses : docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
38+ run : |
39+ sudo apt-get update
40+ sudo apt-get install -y qemu-user-static
4841
4942 - name : Set up Docker Buildx
50- uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
43+ run : |
44+ docker buildx create --name answer-builder --driver docker-container --use
45+ docker buildx inspect --bootstrap
5146
5247 - name : Login to DockerHub
53- uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
54- with :
55- username : ${{ secrets.DOCKERHUB_USER }}
56- password : ${{ secrets.DOCKERHUB_TOKEN }}
48+ run : echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login --username "${{ secrets.DOCKERHUB_USER }}" --password-stdin
5749
5850 - name : Build and push
59- uses : docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
60- with :
61- context : .
62- platforms : linux/amd64,linux/arm64
63- push : true
64- file : ./Dockerfile
65- tags : ${{ steps.meta.outputs.tags }}
66- labels : ${{ steps.meta.outputs.labels }}
51+ env :
52+ IMAGE_TAG : ${{ github.ref_name }}
53+ run : |
54+ BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
55+ docker buildx build \
56+ --file ./Dockerfile \
57+ --platform linux/amd64,linux/arm64 \
58+ --push \
59+ --tag "apache/answer:${IMAGE_TAG#v}" \
60+ --label org.opencontainers.image.created="${BUILD_DATE}" \
61+ --label org.opencontainers.image.revision="${GITHUB_SHA}" \
62+ --label org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}" \
63+ --label org.opencontainers.image.version="${IMAGE_TAG#v}" \
64+ .
0 commit comments