docker: split CA and client into two separate targets

Change-Id: I62ad850f0415e2e161e00fb75ff2d25536888458
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 6f7b9ab..a117fbe 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -13,7 +13,22 @@
   id-token: write
 
 jobs:
-  ndncert:
+  ndncert-build:
     uses: named-data/actions/.github/workflows/docker-image.yml@v1
     with:
-      name: ndncert
+      name: ndncert-build
+      target: build
+  ndncert-ca:
+    needs: ndncert-build
+    uses: named-data/actions/.github/workflows/docker-image.yml@v1
+    with:
+      name: ndncert-ca
+      target: ca
+      contexts: build=docker-image://${{ needs.ndncert-build.outputs.image }}
+  ndncert-client:
+    needs: ndncert-build
+    uses: named-data/actions/.github/workflows/docker-image.yml@v1
+    with:
+      name: ndncert-client
+      target: client
+      contexts: build=docker-image://${{ needs.ndncert-build.outputs.image }}
diff --git a/Dockerfile b/Dockerfile
index 8a83c9b..f364da1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -19,13 +19,12 @@
 EOF
 
 
-FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS ndncert
+FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS ca
 
 COPY --link --from=build /usr/lib/libndn-cert.so.* /usr/lib/
 COPY --link --from=build /usr/bin/ndncert-ca-server /usr/bin/
 COPY --link --from=build /usr/bin/ndncert-ca-status /usr/bin/
 COPY --link --from=build /usr/bin/ndncert-send-email-challenge /usr/bin/
-COPY --link --from=build /usr/bin/ndncert-client /usr/bin/
 
 RUN apt-get install -Uy --no-install-recommends \
         python3 \
@@ -37,4 +36,18 @@
 VOLUME /run/nfd
 
 ENTRYPOINT ["/usr/bin/ndncert-ca-server"]
-CMD ["-c", "/config/ca.conf"]
+CMD ["-c", "/config/ndncert-ca.conf"]
+
+
+FROM ghcr.io/named-data/ndn-cxx-runtime:${NDN_CXX_VERSION} AS client
+
+COPY --link --from=build /usr/lib/libndn-cert.so.* /usr/lib/
+COPY --link --from=build /usr/bin/ndncert-client /usr/bin/
+COPY --link --from=build /etc/ndncert/client.conf.sample /config/ndncert-client.conf
+
+ENV HOME=/config
+VOLUME /config
+VOLUME /run/nfd
+
+ENTRYPOINT ["/usr/bin/ndncert-client"]
+CMD ["-c", "/config/ndncert-client.conf"]