Repository: hyperledger/indy-vdr (language: python)

Issue:
Reuse indy-node-container image
Implements #111


Discussion / hints:
The images of the indy-node-container will be renamed whenever https://github.com/hyperledger/indy-node-container/pull/121 is merged. I'd prefer waiting for this change and adjust this PR before merging.

Fix patch:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 33211a28..38a6dc4f 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -62,13 +62,15 @@ jobs:
 
       - name: Run local node pool
         run: |
-          docker build -f ci/did-indy-pool.dockerfile -t test_pool --build-arg pool_ip=10.0.0.2 ci
-          docker network create --subnet=10.0.0.0/8 indy-sdk-network
-          docker run -d --name indy_pool -p 9701-9708:9701-9708 --net=indy-sdk-network test_pool
+          ./test.sh up
 
       - name: Run tests
         run: cargo test --manifest-path libindy_vdr/Cargo.toml --features local_nodes_pool
 
+      - name: Stop local node pool
+        run: |
+          ./test.sh down
+
   build-release:
     name: Build Library
     needs: [check]
diff --git a/ci/did-indy-pool.dockerfile b/ci/did-indy-pool.dockerfile
deleted file mode 100644
index 69e380d7..00000000
--- a/ci/did-indy-pool.dockerfile
+++ /dev/null
@@ -1,153 +0,0 @@
-FROM --platform=linux/amd64 ubuntu:20.04
-
-ARG uid=1000
-# ARG user=indy
-
-RUN apt-get update -y && apt-get install -y \
-    # common stuff
-    git \
-    wget \
-    gnupg \
-    apt-transport-https \
-    ca-certificates \
-    apt-utils
-
-# ========================================================================================================
-# Update repository signing keys
-# --------------------------------------------------------------------------------------------------------
-# Hyperledger
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9692C00E657DDE61 && \
-    # Sovrin
-    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
-# ========================================================================================================
-
-# Plenum
-#  - https://github.com/hyperledger/indy-plenum/issues/1546
-#  - Needed to pick up rocksdb=5.8.8
-RUN echo "deb  https://hyperledger.jfrog.io/artifactory/indy focal dev"  >> /etc/apt/sources.list && \
-    echo "deb http://security.ubuntu.com/ubuntu bionic-security main"  >> /etc/apt/sources.list && \
-    echo "deb https://repo.sovrin.org/deb bionic master" >> /etc/apt/sources.list && \
-    echo "deb https://repo.sovrin.org/sdk/deb bionic master" >> /etc/apt/sources.list
-
-# Sovrin
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 
-
-RUN apt-get update -y && apt-get install -y \
-    # Python
-    python3-pip \
-    python3-nacl \
-    # rocksdb python wrapper
-    rocksdb=5.8.8 \
-    libgflags-dev \
-    libsnappy-dev \
-    zlib1g-dev \
-    libbz2-dev \
-    liblz4-dev \
-    libgflags-dev \
-    # zstd is needed for caching in github actions pipeline
-    zstd \
-    # fpm
-    ruby \
-    ruby-dev \
-    rubygems \
-    gcc \
-    make \
-    # Indy Node and Plenum
-    libssl1.0.0 \
-    ursa=0.3.2-1 \
-    # Indy SDK
-    libindy=1.15.0~1625-bionic \
-    # Need to move libursa.so to parent dir
-    && mv /usr/lib/ursa/* /usr/lib && rm -rf /usr/lib/ursa
-
-RUN pip3 install -U \
-    # Required by setup.py
-    setuptools==50.3.2 \
-    # Still pinned. Needs to be update like in plenum
-    'pip<10.0.0' \
-    'pyzmq==18.1.0' \
-	'supervisor~=4.2'
-
-
-# install fpm
-RUN gem install --no-document rake fpm
-
-RUN apt-get -y autoremove \
-    && rm -rf /var/lib/apt/lists/*
-
-# Download, build and install indy-node. Will invalidate cache if new HEAD
-ADD https://api.github.com/repos/domwoe/indy-node/git/refs/heads/feature/did-indy-new version.json
-RUN git clone --single-branch -b feature/did-indy-new https://github.com/domwoe/indy-node.git && \
-    pip install -e indy-node
-
-
-RUN echo "[supervisord]\n\
-logfile = /tmp/supervisord.log\n\
-logfile_maxbytes = 50MB\n\
-logfile_backups=10\n\
-logLevel = error\n\
-pidfile = /tmp/supervisord.pid\n\
-nodaemon = true\n\
-minfds = 1024\n\
-minprocs = 200\n\
-umask = 022\n\
-user = indy\n\
-identifier = supervisor\n\
-directory = /tmp\n\
-nocleanup = true\n\
-childlogdir = /tmp\n\
-strip_ansi = false\n\
-\n\
-[program:node1]\n\
-command=start_indy_node Node1 0.0.0.0 9701 0.0.0.0 9702\n\
-directory=/home/indy\n\
-stdout_logfile=/tmp/node1.log\n\
-stderr_logfile=/tmp/node1.log\n\
-\n\
-[program:node2]\n\
-command=start_indy_node Node2 0.0.0.0 9703 0.0.0.0 9704\n\
-directory=/home/indy\n\
-stdout_logfile=/tmp/node2.log\n\
-stderr_logfile=/tmp/node2.log\n\
-\n\
-[program:node3]\n\
-command=start_indy_node Node3 0.0.0.0 9705 0.0.0.0 9706\n\
-directory=/home/indy\n\
-stdout_logfile=/tmp/node3.log\n\
-stderr_logfile=/tmp/node3.log\n\
-\n\
-[program:node4]\n\
-command=start_indy_node Node4 0.0.0.0 9707 0.0.0.0 9708\n\
-directory=/home/indy\n\
-stdout_logfile=/tmp/node4.log\n\
-stderr_logfile=/tmp/node4.log\n"\
->> /etc/supervisord.conf
-
-RUN useradd -ms /bin/bash -u $uid indy
-
-RUN mkdir -p \
-	/etc/indy \
-	/var/lib/indy/backup \
-	/var/lib/indy/plugins \
-	/var/log/indy \
-	&& chown -R indy /etc/indy /var/lib/indy /var/log/indy
-
-USER indy
-
-RUN echo "LEDGER_DIR = '/var/lib/indy'\n\
-LOG_DIR = '/var/log/indy'\n\
-KEYS_DIR = '/var/lib/indy'\n\
-GENESIS_DIR = '/var/lib/indy'\n\
-BACKUP_DIR = '/var/lib/indy/backup'\n\
-PLUGINS_DIR = '/var/lib/indy/plugins'\n\
-NODE_INFO_DIR = '/var/lib/indy'\n\
-NETWORK_NAME = 'sandbox'\n"\
->> /etc/indy/indy_config.py
-
-ARG pool_ip=127.0.0.1
-
-RUN generate_indy_pool_transactions --nodes 4 --clients 5 --nodeNum 1 2 3 4 --ips="$pool_ip,$pool_ip,$pool_ip,$pool_ip"
-
-EXPOSE 9701 9702 9703 9704 9705 9706 9707 9708
-
-CMD ["/usr/local/bin/supervisord"]
diff --git a/ci/indy-pool.dockerfile b/ci/indy-pool.dockerfile
index a0885185..dab8e0f9 100644
--- a/ci/indy-pool.dockerfile
+++ b/ci/indy-pool.dockerfile
@@ -1,49 +1,5 @@
-FROM ubuntu:16.04
-
-ARG uid=1000
-
-# Install environment
-RUN apt-get update -y && apt-get install -y \
-	git \
-	wget \
-	python3.5 \
-	python3-nacl \
-	python3-pip \
-	python3-setuptools \
-	apt-transport-https \
-	ca-certificates \
-	software-properties-common
-
-RUN pip3 install -U \
-	"pip~=9.0" \
-	"setuptools~=50.0" \
-	"supervisor~=4.2"
-
-RUN add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu xenial main universe" && \
-	apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CE7709D068DB5E88
-ARG indy_stream=master
-RUN add-apt-repository "deb https://repo.sovrin.org/deb xenial ${indy_stream}" && \
-	add-apt-repository "deb https://repo.sovrin.org/sdk/deb xenial stable"
-
-RUN useradd -ms /bin/bash -u $uid indy
-
-ARG indy_plenum_ver=1.13.0.dev1032
-ARG indy_node_ver=1.13.0.dev1221
-
-RUN apt-get update -y && apt-get install -y \
-	libsodium18 \
-	libbz2-dev \
-	zlib1g-dev \
-	liblz4-dev \
-	libsnappy-dev \
-	rocksdb=5.8.8 \
-	libindy \
-	ursa \
-	vim
-
-RUN pip3 install \
-	indy-plenum==${indy_plenum_ver} \
-	indy-node==${indy_node_ver}
+FROM ghcr.io/hyperledger/indy-node-container/indy_node:1.13.2-rc5-ubuntu20-main
+RUN pip3 install "supervisor~=4.2"
 
 RUN echo "[supervisord]\n\
 logfile = /tmp/supervisord.log\n\


Test patch:
diff --git a/test.sh b/test.sh
new file mode 100755
index 00000000..cc77cc88
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,50 @@
+#/bin/bash
+
+readonly command=$(basename ${0})
+
+help(){
+    echo "Usage: $command <subcommand> [options]\n"
+    echo "Subcommands:"
+    echo "    up"
+    echo "    test"
+    echo "    down"
+    echo "Default behavior without a subcommand is up, test, down"
+}
+
+up(){
+  docker build -f ci/indy-pool.dockerfile -t test_pool --build-arg pool_ip=10.0.0.2 ci
+  docker network create --subnet=10.0.0.0/8 indy-sdk-network
+  docker run -d --name indy_pool -p 9701-9708:9701-9708 --net=indy-sdk-network test_pool
+}
+
+run_tests(){
+  cargo test  --manifest-path libindy_vdr/Cargo.toml --features local_nodes_pool
+}
+
+down(){
+  docker stop indy_pool
+  docker rm indy_pool
+  docker network rm  indy-sdk-network
+}
+
+subcommand="$1"
+case $subcommand in
+  "-h" | "--help")
+    help
+    ;;
+  "up")
+    up
+    ;;
+  "test" | "tests")
+    run_tests
+    ;;
+  "down")
+    down
+    ;;
+  *)
+    up
+    run_tests
+    down
+    ;;
+esac
+