1d256166d6
After changes on how the final docker image for go-ipfs is generated, our Dockerfiles failed to build. The new version is inspired on go-ipfs Dockerfile. It takes advantage of docker >= v17.06 which allows multi-stage Dockerfiles with several FROM directives and COPY --from. This allows build freely on a first stage, without thinking of cleaning up, and then just copy the final artifacts to a second, minimal image. The Dockerfile-test is similarly updated. Minor changes have been applied to the entrypoints. License: MIT Signed-off-by: Hector Sanjuan <hector@protocol.ai>
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
user=ipfs
|
|
|
|
if [ `id -u` -eq 0 ]; then
|
|
echo "Changing user to $user"
|
|
# ensure directories are writable
|
|
su-exec "$user" test -w "${IPFS_PATH}" || chown -R -- "$user" "${IPFS_PATH}"
|
|
su-exec "$user" test -w "${IPFS_CLUSTER_PATH}" || chown -R -- "$user" "${IPFS_CLUSTER_PATH}"
|
|
exec su-exec "$user" "$0" "$@"
|
|
fi
|
|
|
|
# Second invocation with regular user
|
|
ipfs version
|
|
|
|
if [ -e "${IPFS_PATH}/config" ]; then
|
|
echo "Found IPFS fs-repo at ${IPFS_PATH}"
|
|
else
|
|
ipfs init
|
|
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
|
|
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
|
|
fi
|
|
|
|
ipfs daemon --migrate=true &
|
|
sleep 3
|
|
|
|
ipfs-cluster-service --version
|
|
|
|
if [ -e "${IPFS_CLUSTER_PATH}/service.json" ]; then
|
|
echo "Found IPFS cluster configuration at ${IPFS_CLUSTER_PATH}"
|
|
else
|
|
ipfs-cluster-service init
|
|
sed -i 's/127\.0\.0\.1\/tcp\/9094/0.0.0.0\/tcp\/9094/' "${IPFS_CLUSTER_PATH}/service.json"
|
|
sed -i 's/127\.0\.0\.1\/tcp\/9095/0.0.0.0\/tcp\/9095/' "${IPFS_CLUSTER_PATH}/service.json"
|
|
fi
|
|
|
|
exec ipfs-cluster-service $@
|