Browse Source

upgrade debian base image from v10.10 to v11.0 including upgrade of jq and tini package and required adjustments of entrypoint script

Fabian Peter Hammerle 2 years ago
parent
commit
e2db9d3fc2
2 changed files with 9 additions and 18 deletions
  1. 5 4
      Dockerfile
  2. 4 14
      entrypoint.sh

+ 5 - 4
Dockerfile

@@ -1,10 +1,10 @@
 # on alpine with libc6-compat=1.1.24-r9:
 # > Error relocating /usr/local/bin/ipfs: __fprintf_chk: symbol not found
 # > Error relocating /usr/local/bin/ipfs: __vfprintf_chk: symbol not found
-FROM debian:10.10-slim
+FROM debian:11.0-slim
 
-ARG JQ_PACKAGE_VERSION=1.5+dfsg-2+b1
-ARG TINI_PACKAGE_VERSION=0.18.0-1
+ARG JQ_PACKAGE_VERSION=1.6-2.1
+ARG TINI_PACKAGE_VERSION=0.19.0-1
 ENV IPFS_PATH /ipfs-repo
 RUN apt-get update \
     && apt-get install --no-install-recommends --yes \
@@ -32,7 +32,8 @@ RUN apt-get update \
     && mv /tmp/go-ipfs/ipfs /usr/local/bin \
     && rm -r /tmp/go-ipfs \
     && find / -xdev -type f -perm /u+s -exec chmod --changes u-s {} \; \
-    && find / -xdev -type f -perm /g+s -exec chmod --changes g-s {} \;
+    && find / -xdev -type f -perm /g+s -exec chmod --changes g-s {} \; \
+    && ipfs --version
 
 ENV IPFS_CONFIG_PATH="${IPFS_PATH}/config" \
     IPFS_INIT_PROFILE=server \

+ 4 - 14
entrypoint.sh

@@ -6,38 +6,28 @@ set -eu
 ipfs_config_jq_edit() {
     tmp=$(mktemp)
     (set -x; jq "$@" < "$IPFS_CONFIG_PATH" > "$tmp")
+    #diff -u "$IPFS_CONFIG_PATH" "$tmp" || true
     mv "$tmp" "$IPFS_CONFIG_PATH"
 }
 
-# --args available in jq >= 1.6
-# https://github.com/stedolan/jq/commit/66fb962a6608805f4d7667d39ad0d88158bd1262
-# compare fphammerle/docker-ipfs v0.2.0
-args_to_json_array() {
-    if [ -z "$@" ]; then
-        printf '[]\n'
-    else
-        printf '%s\n' "$@" | jq -R . | jq -sc .
-    fi
-}
-
 if [ ! -e "$IPFS_CONFIG_PATH" ]; then
     (set -x; ipfs init --empty-repo --profile $IPFS_INIT_PROFILE)
 fi
 
 if [ "$IPFS_API_ADDR" != "default" ]; then
-    ipfs_config_jq_edit '.Addresses.API = $ARGS[0]' --argjson ARGS "$(args_to_json_array "$IPFS_API_ADDR")"
+    ipfs_config_jq_edit '.Addresses.API = $ARGS.positional[0]' --args "$IPFS_API_ADDR"
 fi
 
 if [ "$IPFS_SWARM_ADDRS" != "default" ]; then
     # + ipfs config --json Addresses.Swarm '["/ip4/0.0.0.0/tcp/4001"]'
     # Error: api not running
-    ipfs_config_jq_edit '.Addresses.Swarm |= $ARGS' --argjson ARGS "$(args_to_json_array $IPFS_SWARM_ADDRS)"
+    ipfs_config_jq_edit '.Addresses.Swarm |= $ARGS.positional' --args $IPFS_SWARM_ADDRS
 fi
 
 if [ ! -z "$IPFS_BOOTSTRAP_ADD" ]; then
     # + ipfs bootstrap add -- /dnsaddr/...
     # Error: api not running
-    ipfs_config_jq_edit '.Bootstrap |= (. + $ARGS | unique)' --argjson ARGS "$(args_to_json_array $IPFS_BOOTSTRAP_ADD)"
+    ipfs_config_jq_edit '.Bootstrap |= (. + $ARGS.positional | unique)' --args $IPFS_BOOTSTRAP_ADD
 fi
 
 (set -x; exec "$@")