@@ -15,13 +15,57 @@ jobs:
1515 with :
1616 fetch-depth : ' 0'
1717
18- - name : Build the Docker image
19- run : docker build -t docker-netbootxyz:${{ github.sha }} .
18+ - name : Set up Docker Buildx
19+ uses : docker/setup-buildx-action@v3
20+
21+ - name : Set up QEMU
22+ uses : docker/setup-qemu-action@v3
23+
24+ - name : Login to the Docker Container Registry
25+ uses : docker/login-action@v3
26+ with :
27+ username : ${{ secrets.DOCKERHUB_USER }}
28+ password : ${{ secrets.DOCKERHUB_TOKEN }}
29+
30+ - name : Login to the GitHub Container Registry
31+ uses : docker/login-action@v3
32+ with :
33+ registry : ghcr.io
34+ username : ${{ secrets.GHCR_USER }}
35+ password : ${{ secrets.GHCR_TOKEN }}
36+
37+ - name : Get latest Webapp release version
38+ run : |
39+ WEBAPP_RELEASE=$(curl -sX GET "https://api.github.com/repos/netbootxyz/webapp/releases/latest" | jq -r '. | .tag_name')
40+ echo "WEBAPP_RELEASE=${WEBAPP_RELEASE}" >> $GITHUB_ENV
41+
42+ - name : Build and push PR test image
43+ uses : docker/build-push-action@v6
44+ with :
45+ push : true
46+ context : .
47+ file : ./Dockerfile
48+ platforms : linux/amd64,linux/arm64
49+ build-args : |
50+ WEBAPP_VERSION=${{ env.WEBAPP_RELEASE }}
51+ VERSION=pr-${{ github.event.number }}
52+ BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S')
53+ tags : |
54+ netbootxyz/netbootxyz:pr-${{ github.event.number }}
55+ netbootxyz/netbootxyz:pr-${{ github.event.number }}-${{ github.sha }}
56+ ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}
57+ ghcr.io/netbootxyz/netbootxyz:pr-${{ github.event.number }}-${{ github.sha }}
58+ labels : |
59+ org.opencontainers.image.title=netbootxyz
60+ org.opencontainers.image.description=netboot.xyz PR test image
61+ org.opencontainers.image.version=pr-${{ github.event.number }}
62+ org.opencontainers.image.revision=${{ github.sha }}
63+ org.opencontainers.image.source=https://github.com/netbootxyz/docker-netbootxyz
2064
2165 - name : Run Trivy vulnerability scanner
2266 uses : aquasecurity/trivy-action@0.31.0
2367 with :
24- image-ref : ' docker- netbootxyz: ${{ github.sha }}'
68+ image-ref : ' ghcr.io/ netbootxyz/netbootxyz:pr- ${{ github.event.number }}'
2569 format : ' table'
2670 exit-code : ' 1'
2771 ignore-unfixed : true
0 commit comments