Browse Source

select ipfs arch depending on hardware arch

Fabian Peter Hammerle 5 years ago
parent
commit
cf94f4c445
2 changed files with 12 additions and 2 deletions
  1. 2 2
      Dockerfile
  2. 10 0
      ipfs-arch.sh

+ 2 - 2
Dockerfile

@@ -16,8 +16,8 @@ RUN mkdir -m u=rwx,g=,o= $IPFS_PATH && chown ipfs $IPFS_PATH
 VOLUME $IPFS_PATH
 
 ENV IPFS_VERSION 0.4.18
-ENV IPFS_ARCH amd64
-RUN wget -O- https://dist.ipfs.io/go-ipfs/v${IPFS_VERSION}/go-ipfs_v${IPFS_VERSION}_linux-${IPFS_ARCH}.tar.gz \
+COPY ipfs-arch.sh /
+RUN wget -O- https://dist.ipfs.io/go-ipfs/v${IPFS_VERSION}/go-ipfs_v${IPFS_VERSION}_linux-$(/ipfs-arch.sh).tar.gz \
         | tar -xz -C /tmp \
     && mv /tmp/go-ipfs/ipfs /usr/local/bin \
     && rm -r /tmp/go-ipfs

+ 10 - 0
ipfs-arch.sh

@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case $(arch) in
+    x86_64)
+        echo amd64 ;;
+    aarch64)
+        echo arm ;;
+    *)
+        exit 1 ;;
+esac