From e90db8f17f78d8641262517120bedf85d79bd383 Mon Sep 17 00:00:00 2001 From: crebsy <121096251+crebsy@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:06:02 +0200 Subject: [PATCH] feat: add entrypoint.sh and allow to specify more cli flags --- Dockerfile | 9 +++++---- entrypoint.sh | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index e04b3c666e8..03513618e19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,6 +55,7 @@ COPY --from=utilities /etc/ssl/certs /etc/ssl/certs COPY --from=builder $SRC_DIR/cmd/ipfs/ipfs /usr/local/bin/ipfs COPY --from=builder $SRC_DIR/bin/container_daemon /usr/local/bin/start_ipfs COPY --from=builder $SRC_DIR/bin/container_init_run /usr/local/bin/container_init_run +COPY --from=builder $SRC_DIR/entrypoint.sh /usr/local/bin/entrypoint.sh # Add suid bit on fusermount so it will run properly RUN chmod 4755 /usr/local/bin/fusermount @@ -62,6 +63,9 @@ RUN chmod 4755 /usr/local/bin/fusermount # Fix permissions on start_ipfs (ignore the build machine's permissions) RUN chmod 0755 /usr/local/bin/start_ipfs +# Fix permissions for entrypoint.sh +RUN chmod 0755 /usr/local/bin/entrypoint.sh + # Swarm TCP; should be exposed to the public EXPOSE 4001 # Swarm UDP; should be exposed to the public @@ -98,12 +102,9 @@ ENV IPFS_LOGGING "" # This just makes sure that: # 1. There's an fs-repo, and initializes one if there isn't. # 2. The API and Gateway are accessible from outside the container. -ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/start_ipfs"] +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] # Healthcheck for the container # QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn is the CID of empty folder HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD ipfs --api=/ip4/127.0.0.1/tcp/5001 dag stat /ipfs/QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn || exit 1 - -# Execute the daemon subcommand by default -CMD ["daemon", "--migrate=true", "--agent-version-suffix=docker"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000000..a4d5091b2f6 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +# Execute the daemon subcommand by default +/sbin/tini -s -- /usr/local/bin/start_ipfs daemon \ + --migrate=true \ + --agent-version-suffix=docker \ + ${CMD_EXTRA_FLAGS}