From 6d035df93b62d8a2690540817b585ef20896803a Mon Sep 17 00:00:00 2001 From: James Walker Date: Mon, 2 Jan 2023 22:35:10 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=89=20initial=20commit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 13 +++++++++++++ README.md | 3 +++ pin.sh | 17 +++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100755 pin.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d0e3785 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM node:lts + +ENV CLUSTER_VERSION v1.0.4 +ENV CLUSTER_TAR ipfs-cluster-ctl_${CLUSTER_VERSION}_linux-amd64.tar.gz + +RUN set -x \ + && wget "https://dist.ipfs.io/ipfs-cluster-ctl/$CLUSTER_VERSION/$CLUSTER_TAR" \ + && tar -xzf "$CLUSTER_TAR" --strip-components=1 ipfs-cluster-ctl/ipfs-cluster-ctl \ + && mv ipfs-cluster-ctl /usr/local/bin + +ADD pin.sh /usr/local/bin/pin.sh + +ENTRYPOINT [ "/usr/local/bin/pin.sh" ] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..98a54f4 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Drone IPFS Cluster + +Publishes files to ipfs-cluster. \ No newline at end of file diff --git a/pin.sh b/pin.sh new file mode 100755 index 0000000..44df273 --- /dev/null +++ b/pin.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +HOST=${PLUGIN_CLUSTER_HOST:-"/dns4/cluster.walkah.cloud"} + +# pin to cluster +root_cid=$(ipfs-cluster-ctl \ + --host "$HOST" \ + --basic-auth "${PLUGIN_CLUSTER_USER}:${PLUGIN_CLUSTER_PASSWORD}" \ + add \ + --quieter \ + --cid-version 1 \ + --name "${PLUGIN_PIN_NAME}" \ + --recursive \ + $PLUGIN_EXTRA_ARGS \ + "$PLUGIN_PATH" ) + +echo "$root_cid" \ No newline at end of file