ci: switch to reusable workflow to publish Docker images

Change-Id: Ia177e97401b0239822cc9814340c194974c611ea
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index d21badd..172f8d2 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -15,71 +15,32 @@
 
 permissions:
   packages: write
-
-env:
-  REGISTRY: ghcr.io
+  id-token: write
 
 jobs:
+  nfd-build:
+    uses: named-data/actions/.github/workflows/docker-image.yml@v1
+    with:
+      name: nfd-build
+      target: build
   nfd:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-        with:
-          submodules: true
-
-      - name: Login to ${{ env.REGISTRY }}
-        uses: docker/login-action@v3
-        with:
-          registry: ${{ env.REGISTRY }}
-          username: ${{ github.actor }}
-          password: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Extract metadata
-        id: meta
-        uses: docker/metadata-action@v5
-        with:
-          images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/nfd
-          flavor: latest=true
-
-      - name: Build and push Docker image
-        uses: docker/build-push-action@v5
-        with:
-          context: .
-          target: nfd
-          pull: true
-          push: true
-          tags: ${{ steps.meta.outputs.tags }}
-          labels: ${{ steps.meta.outputs.labels }}
-
+    needs: nfd-build
+    uses: named-data/actions/.github/workflows/docker-image.yml@v1
+    with:
+      name: nfd
+      target: nfd
+      contexts: build=docker-image://${{ needs.nfd-build.outputs.image }}
+  nfd-autoreg:
+    needs: nfd-build
+    uses: named-data/actions/.github/workflows/docker-image.yml@v1
+    with:
+      name: nfd-autoreg
+      target: nfd-autoreg
+      contexts: build=docker-image://${{ needs.nfd-build.outputs.image }}
   nfd-status-http-server:
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout repository
-        uses: actions/checkout@v4
-        with:
-          submodules: true
-
-      - name: Login to ${{ env.REGISTRY }}
-        uses: docker/login-action@v3
-        with:
-          registry: ${{ env.REGISTRY }}
-          username: ${{ github.actor }}
-          password: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Extract metadata
-        id: meta
-        uses: docker/metadata-action@v5
-        with:
-          images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/nfd-status-http-server
-          flavor: latest=true
-
-      - name: Build and push Docker image
-        uses: docker/build-push-action@v5
-        with:
-          context: .
-          target: nfd-status-http-server
-          pull: true
-          push: true
-          tags: ${{ steps.meta.outputs.tags }}
-          labels: ${{ steps.meta.outputs.labels }}
+    needs: nfd-build
+    uses: named-data/actions/.github/workflows/docker-image.yml@v1
+    with:
+      name: nfd-status-http-server
+      target: nfd-status-http-server
+      contexts: build=docker-image://${{ needs.nfd-build.outputs.image }}