mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
51 lines
1.1 KiB
Plaintext
51 lines
1.1 KiB
Plaintext
|
#!/bin/sh
|
||
|
|
||
|
set -e
|
||
|
|
||
|
DOCKER="${DOCKER:-%DOCKER%}"
|
||
|
IMAGE="%IMAGE%"
|
||
|
NETWORK="${NETWORK:-host}"
|
||
|
PROJECTDIR="${PROJECTDIR:-%PROJECTDIR%}"
|
||
|
DOBUILDDIR="${DOBUILDDIR:-%DOBUILDDIR%}"
|
||
|
ENTRYPOINT="${ENTRYPOINT:-%RUNCMD%}"
|
||
|
PATH="${DOBUILDDIR}/bin:$PATH"
|
||
|
|
||
|
set -- --entrypoint "$ENTRYPOINT" "$IMAGE" "$@"
|
||
|
set -- --network "$NETWORK" --workdir "$PWD" "$@"
|
||
|
|
||
|
if [ -n "$USERID" ]; then
|
||
|
set -- --user "$USERID:$USERID" "$@"
|
||
|
fi
|
||
|
|
||
|
if [ -n "$PID" ]; then
|
||
|
set -- --pid "$PID" "$@"
|
||
|
fi
|
||
|
|
||
|
if [ -n "$CONTAINER_CGROUP_PARENT" ]; then
|
||
|
set -- --cgroup-parent "$CONTAINER_CGROUP_PARENT" "$@"
|
||
|
fi
|
||
|
|
||
|
HOST_CONTAINER="${HOST_CONTAINER:-"$(get_container_id.sh)"}" || true
|
||
|
if [ -n "$HOST_CONTAINER" ]; then
|
||
|
set -- --volumes-from "$HOST_CONTAINER" "$@"
|
||
|
else
|
||
|
set -- --volume "$PROJECTDIR:$PROJECTDIR:cached" "$@"
|
||
|
fi
|
||
|
|
||
|
set -- %RUNFLAGS% "$@"
|
||
|
|
||
|
if [ -t 0 ] && ! is_running_in_bg.sh $$; then
|
||
|
set -- --interactive "$@"
|
||
|
fi
|
||
|
|
||
|
# if STDIN piped or redirected
|
||
|
if [ -p /dev/stdin ] || { [ ! -t 0 ] && [ ! -p /dev/stdin ]; }; then
|
||
|
set -- --interactive "$@"
|
||
|
elif [ -t 1 ]; then
|
||
|
set -- --tty "$@"
|
||
|
fi
|
||
|
|
||
|
set -- --rm "$@"
|
||
|
|
||
|
exec "$DOCKER" run "$@"
|