From 6037cd9217d5e281c68d679e9b3acd8d6f9af82b Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 9 Oct 2021 18:30:12 +0200 Subject: [PATCH 1/2] Added IPFS --- .github/workflows/build.yml | 2 +- go-ipfs/Dockerfile | 61 +++++++++++++++++++++++++++++++++++++ ipfs-cluster/Dockerfile | 55 +++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 go-ipfs/Dockerfile create mode 100644 ipfs-cluster/Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3dd7d58..15f33a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - repository: [docker2mqtt, gandi, mopidy, piwigo-souvenirs, restic-auto, restic-rest, shairport-sync, slack-eraser, snapserver, telegraf] + repository: [docker2mqtt, gandi, mopidy, piwigo-souvenirs, restic-auto, restic-rest, shairport-sync, slack-eraser, snapserver, telegraf, go-ipfs, ipfs-cluster] steps: - name: Checkout diff --git a/go-ipfs/Dockerfile b/go-ipfs/Dockerfile new file mode 100644 index 0000000..dcba5ac --- /dev/null +++ b/go-ipfs/Dockerfile @@ -0,0 +1,61 @@ +FROM golang:1.16.7-buster + +RUN apt-get update && apt-get install -y libssl-dev ca-certificates fuse + +ENV IPFS_VERSION v0.10.0 +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + "armhf") dpkgArch="arm" ;;\ + esac; \ + cd /tmp \ + && curl -L -s -o go-ipfs.tgz https://github.com/ipfs/go-ipfs/releases/download/$IPFS_VERSION/go-ipfs_${IPFS_VERSION}_linux-${dpkgArch}.tar.gz \ + && tar xzf go-ipfs.tgz \ + && curl -L -s -o container_daemon https://raw.githubusercontent.com/ipfs/go-ipfs/master/bin/container_daemon + +ENV SUEXEC_VERSION v0.2 +ENV TINI_VERSION v0.19.0 +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + "amd64" | "armhf" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac \ + && cd /tmp \ + && git clone https://github.com/ncopa/su-exec.git \ + && cd su-exec \ + && git checkout -q $SUEXEC_VERSION \ + && make su-exec-static \ + && cd /tmp \ + && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/$tiniArch \ + && chmod +x tini + +# Now comes the actual target image, which aims to be as small as possible. +FROM busybox:1.31.1-glibc + +COPY --from=0 /tmp/go-ipfs/ipfs /usr/local/bin/ipfs +COPY --from=0 /tmp/container_daemon /usr/local/bin/start_ipfs +COPY --from=0 /tmp/su-exec/su-exec-static /sbin/su-exec +COPY --from=0 /tmp/tini /sbin/tini +COPY --from=0 /bin/fusermount /usr/local/bin/fusermount +COPY --from=0 /etc/ssl/certs /etc/ssl/certs + +RUN chmod 4755 /usr/local/bin/fusermount \ + && chmod 0755 /usr/local/bin/start_ipfs + +COPY --from=0 /lib/*-linux-gnu*/libdl.so.2 /lib/ +COPY --from=0 /usr/lib/*-linux-gnu*/libssl.so* /usr/lib/ +COPY --from=0 /usr/lib/*-linux-gnu*/libcrypto.so* /usr/lib/ + +ENV IPFS_PATH /data/ipfs +RUN mkdir -p $IPFS_PATH \ + && adduser -D -h $IPFS_PATH -u 1000 -G users ipfs \ + && chown ipfs:users $IPFS_PATH \ + && mkdir /ipfs /ipns \ + && chown ipfs:users /ipfs /ipns + +ENV IPFS_LOGGING "" + +ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start_ipfs"] + +CMD ["daemon", "--migrate=true"] diff --git a/ipfs-cluster/Dockerfile b/ipfs-cluster/Dockerfile new file mode 100644 index 0000000..d237262 --- /dev/null +++ b/ipfs-cluster/Dockerfile @@ -0,0 +1,55 @@ +# Note: when updating the go minor version here, also update the go-channel in snap/snapcraft.yml +FROM golang:1.16.7-buster + +RUN apt-get update && apt-get install -y libssl-dev ca-certificates fuse + +ENV IPFS_CLUSTER_VERSION v0.14.1 +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + "armhf") dpkgArch="arm";; \ + esac \ + && cd /tmp \ + && for BINARY in ipfs-cluster-ctl ipfs-cluster-follow ipfs-cluster-service ; do \ + curl -L -s -o ${BINARY}.tgz https://dist.ipfs.io/${BINARY}/$IPFS_CLUSTER_VERSION/${BINARY}_${IPFS_CLUSTER_VERSION}_linux-${dpkgArch}.tar.gz; \ + tar xzf ${BINARY}.tgz; \ + done \ + && curl -L -s -o entrypoint.sh https://raw.githubusercontent.com/ipfs/ipfs-cluster/master/docker/entrypoint.sh + +ENV SUEXEC_VERSION v0.2 +ENV TINI_VERSION v0.19.0 +RUN set -eux; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + "amd64" | "armhf" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + cd /tmp \ + && git clone https://github.com/ncopa/su-exec.git \ + && cd su-exec \ + && git checkout -q $SUEXEC_VERSION \ + && make su-exec-static \ + && cd /tmp \ + && wget -q -O tini https://github.com/krallin/tini/releases/download/$TINI_VERSION/$tiniArch \ + && chmod +x tini + +# Now comes the actual target image, which aims to be as small as possible. +FROM busybox:1.31.1-glibc + +COPY --from=0 /tmp/ipfs-cluster-ctl/ipfs-cluster-ctl /tmp/ipfs-cluster-follow/ipfs-cluster-follow /tmp/ipfs-cluster-service/ipfs-cluster-service /usr/local/bin/ +COPY --from=0 /tmp/su-exec/su-exec-static /sbin/su-exec +COPY --from=0 /tmp/tini /sbin/tini +COPY --from=0 /bin/fusermount /usr/local/bin/fusermount +COPY --from=0 /etc/ssl/certs /etc/ssl/certs + +ENV IPFS_CLUSTER_PATH /data/ipfs-cluster +ENV IPFS_CLUSTER_CONSENSUS crdt +ENV IPFS_CLUSTER_DATASTORE leveldb + +RUN mkdir -p $IPFS_CLUSTER_PATH && \ + adduser -D -h $IPFS_CLUSTER_PATH -u 1000 -G users ipfs && \ + chown ipfs:users $IPFS_CLUSTER_PATH + +ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/entrypoint.sh"] + +CMD ["daemon"] From e74c05a281ba8c2e84ee1e67394bf550569f0929 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 9 Oct 2021 22:58:33 +0200 Subject: [PATCH 2/2] Added IPFS --- go-ipfs/Dockerfile | 4 ++-- ipfs-cluster/Dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go-ipfs/Dockerfile b/go-ipfs/Dockerfile index dcba5ac..6821d18 100644 --- a/go-ipfs/Dockerfile +++ b/go-ipfs/Dockerfile @@ -6,7 +6,7 @@ ENV IPFS_VERSION v0.10.0 RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ - "armhf") dpkgArch="arm" ;;\ + "armhf" | "armel") dpkgArch="arm" ;;\ esac; \ cd /tmp \ && curl -L -s -o go-ipfs.tgz https://github.com/ipfs/go-ipfs/releases/download/$IPFS_VERSION/go-ipfs_${IPFS_VERSION}_linux-${dpkgArch}.tar.gz \ @@ -18,7 +18,7 @@ ENV TINI_VERSION v0.19.0 RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ - "amd64" | "armhf" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ + "amd64" | "armhf" | "armel" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac \ && cd /tmp \ diff --git a/ipfs-cluster/Dockerfile b/ipfs-cluster/Dockerfile index d237262..e5ce9db 100644 --- a/ipfs-cluster/Dockerfile +++ b/ipfs-cluster/Dockerfile @@ -7,7 +7,7 @@ ENV IPFS_CLUSTER_VERSION v0.14.1 RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ - "armhf") dpkgArch="arm";; \ + "armhf" | "armel") dpkgArch="arm";; \ esac \ && cd /tmp \ && for BINARY in ipfs-cluster-ctl ipfs-cluster-follow ipfs-cluster-service ; do \ @@ -21,7 +21,7 @@ ENV TINI_VERSION v0.19.0 RUN set -eux; \ dpkgArch="$(dpkg --print-architecture)"; \ case "${dpkgArch##*-}" in \ - "amd64" | "armhf" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ + "amd64" | "armhf" | "armel" | "arm64") tiniArch="tini-static-$dpkgArch" ;;\ *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ esac; \ cd /tmp \