-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): /container-init.d for advanced initialization (ipfs#6577)
* Add initialization directory support to Docker image * Add sharness test, fix bugs in init script Fixed in init script: - Added some missing quotes around expansions - Fixed INIT_ARGS to not pass any args if IPFS_PROFILE isn't specified - Use printf instead of "echo -e" - Only run scripts in top-level of init dir - Handle filenames correctly when finding init scripts (by using find + xargs) * chore: docker cleanup cleans up containers and images (useful when run on developer machine) * remove container init documentation from README There is already IPFS Docker documentation where this should live: https://docs.ipfs.io/how-to/run-ipfs-inside-docker/ Co-authored-by: Caian <[email protected]> Co-authored-by: Marcin Rataj <[email protected]> Co-authored-by: Gus Eggert <[email protected]>
- Loading branch information
Showing
6 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ LABEL maintainer="Steven Allen <[email protected]>" | |
ENV SRC_DIR /go-ipfs | ||
COPY --from=0 $SRC_DIR/cmd/ipfs/ipfs /usr/local/bin/ipfs | ||
COPY --from=0 $SRC_DIR/bin/container_daemon /usr/local/bin/start_ipfs | ||
COPY --from=0 $SRC_DIR/bin/container_init_run /usr/local/bin/container_init_run | ||
COPY --from=0 /tmp/su-exec/su-exec-static /sbin/su-exec | ||
COPY --from=0 /tmp/tini /sbin/tini | ||
COPY --from=0 /bin/fusermount /usr/local/bin/fusermount | ||
|
@@ -93,6 +94,10 @@ RUN mkdir -p $IPFS_PATH \ | |
RUN mkdir /ipfs /ipns \ | ||
&& chown ipfs:users /ipfs /ipns | ||
|
||
# Create the init scripts directory | ||
RUN mkdir /container-init.d \ | ||
&& chown ipfs:users /container-init.d | ||
|
||
# Expose the fs-repo as a volume. | ||
# start_ipfs initializes an fs-repo if none is mounted. | ||
# Important this happens after the USER directive so permissions are correct. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# used by the container startup script for running initialization scripts | ||
|
||
script="$1" | ||
if [ -x "$script" ] ; then | ||
printf "Executing '%s'...\n" "$script" | ||
"$script" | ||
else | ||
printf "Sourcing '%s'...\n" "$script" | ||
. "$script" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters