mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
refactor(mkdockerbuild): extracts common parts (#24)
* fixes mount of project in wrapper scripts, when not running in container * refactors makefile in preparation to extract common parts * refactors makefiles and scripts * fix git ignore matches * adds support to disable fetch * update * fixes docker warning about unused build argument * adds support to force offline build fixes shell escaping changes paths to relative where possible * moves make docker builder support files * removes unnecessary configuration elements * fixes initial download directory creation * adds missing rule for initial download directory creation * fixes docker error: unable to prepare context copies dockerfile to build context, in order to remove dependency to unsupported/new docker feature
This commit is contained in:
50
build/mkdocker/resources/run_image.sh.template
Normal file
50
build/mkdocker/resources/run_image.sh.template
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
DOCKER="${DOCKER:-%DOCKER%}"
|
||||
IMAGE="${IMAGE:-%IMAGE%}"
|
||||
NETWORK="${NETWORK:-host}"
|
||||
PROJECTDIR="${PROJECTDIR:-%PROJECTDIR%}"
|
||||
SCRIPTDIR="${SCRIPTDIR:-%SCRIPTDIR%/bin}"
|
||||
ENTRYPOINT="${ENTRYPOINT:-%RUNCMD%}"
|
||||
PATH="${SCRIPTDIR}:$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 "$@"
|
||||
Reference in New Issue
Block a user