@cryptotaxi247 / kubo / commits / 77e4c64ac

Dockerfile: Deprecate implicit daemon argument

After the discussion in https://github.com/ipfs/go-ipfs/pull/3573 this patch prints a deprecation warning if: 1) the image has been executed with additional arguments 2) the first argument isn't daemon This way people are able to migrate to the new syntax without any breaking changes. License: MIT Signed-off-by: kpcyrd <git@rxv.cc>

kpcyrd committed Feb 12, 2017 at 20:44 UTC 77e4c64ac02e01afbbd92e516371f3a742d766d4
3 files changed +20
Dockerfile
+3
@@ -74,3 +74,6 @@ VOLUME $IPFS_PATH
74 # 1. There's an fs-repo, and initializes one if there isn't.
75 # 2. The API and Gateway are accessible from outside the container.
76 ENTRYPOINT ["/usr/local/bin/start_ipfs"]
77 +
78 +# Execute the daemon subcommand by default
79 +CMD ["daemon"]
Dockerfile.fast
+1
@@ -53,3 +53,4 @@ RUN cd $SRC_PATH \
53 USER ipfs
54 VOLUME $IPFS_PATH
55 ENTRYPOINT ["/usr/local/bin/start_ipfs"]
56 +CMD ["daemon"]
bin/container_daemon
+16
@@ -19,4 +19,20 @@ else
19 ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
20 fi
21
22 +# if the first argument is daemon
23 +if [ "$1" = "daemon" ]; then
24 + # filter the first argument until
25 + # https://github.com/ipfs/go-ipfs/pull/3573
26 + # has been resolved
27 + shift
28 +else
29 + # print deprecation warning
30 + # go-ipfs used to hardcode "ipfs daemon" in it's entrypoint
31 + # this workaround supports the new syntax so people start setting daemon explicitly
32 + # when overwriting CMD, making this PR safe to merge
33 + echo "DEPRECATED: arguments have been set but the first argument isn't 'daemon'" >&2
34 + echo "DEPRECATED: run 'docker run ipfs/go-ipfs daemon $@' instead" >&2
35 + echo "DEPRECATED: see https://github.com/ipfs/go-ipfs/pull/3573 for more information" >&2
36 +fi
37 +
38 exec ipfs daemon "$@"