From acadeb220a750f827f4bb551048d28d2604ce2f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com>
Date: Tue, 5 Jul 2022 20:00:22 -0400
Subject: [PATCH] docker: add dhtnode image

---
 .github/workflows/release-package.yml | 41 +++++++++++++++++++++++++--
 docker/DockerfileDhtnode              |  4 +++
 2 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 docker/DockerfileDhtnode

diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml
index f25a84c1..198011b3 100644
--- a/.github/workflows/release-package.yml
+++ b/.github/workflows/release-package.yml
@@ -3,7 +3,7 @@
 # separate terms of service, privacy policy, and support
 # documentation.
 
-name: Create release, publish Docker images and python package
+name: Release actions
 
 on:
   push:
@@ -16,6 +16,7 @@ env:
   IMAGE_NAME: ${{ github.repository }}/opendht
   IMAGE_NAME_DEPS_LLVM: ${{ github.repository }}/opendht-deps-llvm
   IMAGE_NAME_LLVM: ${{ github.repository }}/opendht-llvm
+  IMAGE_NAME_DHTNODE: ${{ github.repository }}/dhtnode
 
 jobs:
   build-and-push-deps-image:
@@ -107,7 +108,7 @@ jobs:
         id: meta
         uses: docker/metadata-action@v4
         with:
-          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_DEPS }}
+          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_DEPS_LLVM }}
 
       - name: Build and push Docker image
         uses: docker/build-push-action@v3
@@ -141,7 +142,7 @@ jobs:
         uses: docker/metadata-action@v4
         with:
           images: |
-            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
+            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LLVM }}
 
       - name: Build and push Docker image
         uses: docker/build-push-action@v3
@@ -152,6 +153,40 @@ jobs:
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
 
+  build-and-push-image-dhtnode:
+    name: dhtnode Docker image (LLVM)
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v3
+
+      - name: Log in to the Container registry
+        uses: docker/login-action@v2
+        with:
+          registry: ${{ env.REGISTRY }}
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Extract metadata (tags, labels) for Docker
+        id: meta
+        uses: docker/metadata-action@v4
+        with:
+          images: |
+            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_DHTNODE }}
+
+      - name: Build and push Docker image
+        uses: docker/build-push-action@v3
+        with:
+          context: .
+          file: docker/DockerfileDhtnode
+          push: true
+          tags: ${{ steps.meta.outputs.tags }}
+          labels: ${{ steps.meta.outputs.labels }}
+
   build-python-wheel:
     name: Release and build Python Wheel package
     runs-on: ubuntu-latest
diff --git a/docker/DockerfileDhtnode b/docker/DockerfileDhtnode
new file mode 100644
index 00000000..aba18231
--- /dev/null
+++ b/docker/DockerfileDhtnode
@@ -0,0 +1,4 @@
+FROM ghcr.io/savoirfairelinux/opendht/opendht:latest
+CMD ["dhtnode", "-b", "bootstrap.jami.net", "-p", "4222", "--proxyserver", "8080"]
+EXPOSE 4222/udp
+EXPOSE 8080/tcp
-- 
GitLab