mirror of
https://github.com/falk-werner/webfuse
synced 2025-05-31 22:44:26 +00:00
fixes run in dind setup
This commit is contained in:
parent
e21768e2f7
commit
03debbe2e8
18
Makefile
18
Makefile
@ -150,13 +150,16 @@ echo_if_silent = VERBOSE=1
|
||||
$(VERBOSE)echo_if_silent = echo $1
|
||||
$(VERBOSE)SILENT := @
|
||||
|
||||
$(HOST_CONTAINER)image_run_volumes += '$(realpath $(PROJECT_ROOT)):$(CONTAINER_PROJECT_ROOT):cached'
|
||||
$(HOST_CONTAINER)image_run_volumes += '$(realpath $(OUT)/$1):$(CONTAINER_OUT)/$1:delegated'
|
||||
$(HOST_CONTAINER)image_run_volumes += --volume '$(realpath $(PROJECT_ROOT)):$(CONTAINER_PROJECT_ROOT):cached'
|
||||
$(HOST_CONTAINER)image_run_volumes += --volume '$(realpath $(OUT)/$1):$(CONTAINER_OUT)/$1:delegated'
|
||||
image_run_volumes += $(addprefix --volumes-from ,$2)
|
||||
|
||||
image_name = $(REGISTRY_PREFIX)$(subst -,/,$1)/$(PROJECT_NAME):$(VERSION)
|
||||
image_run = $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
|
||||
$(addprefix --volume ,$(call image_run_volumes,$1)) \
|
||||
image_run = $(DOCKER) run $(DOCKER_RUNFLAGS) \
|
||||
$(call image_run_volumes,$1,$(HOST_CONTAINER)) \
|
||||
$(addprefix --cgroup-parent ,$(CONTAINER_CGROUP_PARENT)) \
|
||||
--workdir '$(CONTAINER_OUT)/$1/$(BUILDTYPE)' \
|
||||
$3 \
|
||||
$(call image_name,$1) \
|
||||
$2
|
||||
|
||||
@ -214,10 +217,11 @@ wrapper_rule = \
|
||||
wrapper = \
|
||||
$(call echo_if_silent,generating $@) \
|
||||
&& sed \
|
||||
-e 's@%PROJECT_ROOT%@$(abspath $(PROJECT_ROOT))@g' \
|
||||
-e 's@%DOCKER%@$(DOCKER)@g' \
|
||||
-e 's@%DOCKER_RUNFLAGS%@$(DOCKER_RUNFLAGS) $(addprefix --volume ,$(call image_run_volumes,$1))@g' \
|
||||
-e 's@%DOCKER_IMAGE%@$(call image_name,$1)@g' \
|
||||
-e 's@%DOCKER_RUNCMD%@$(notdir $@)@g' \
|
||||
-e 's@%RUNFLAGS%@$(DOCKER_RUNFLAGS) $(call image_run_volumes,$1)@g' \
|
||||
-e 's@%IMAGE%@$(call image_name,$1)@g' \
|
||||
-e 's@%RUNCMD%@$(notdir $@)@g' \
|
||||
$< > $@ \
|
||||
&& chmod +x $@
|
||||
|
||||
|
@ -2,15 +2,35 @@
|
||||
|
||||
set -e
|
||||
|
||||
DOCKER="${DOCKER:-'%DOCKER%'}"
|
||||
DOCKER_IMAGE="{DOCKER_IMAGE:-'%DOCKER_IMAGE%'}"
|
||||
PROJECT_ROOT="${PROJECT_ROOT:-%PROJECT_ROOT%}"
|
||||
|
||||
DOCKER_RUNFLAGS+=( %DOCKER_RUNFLAGS% )
|
||||
DOCKER_RUNFLAGS+=( --network host )
|
||||
DOCKER_RUNFLAGS+=( --workdir "$PWD" )
|
||||
DOCKER="${DOCKER:-%DOCKER%}"
|
||||
IMAGE="${IMAGE:-%IMAGE%}"
|
||||
NETWORK="${NETWORK:-host}"
|
||||
HOST_CONTAINER="${HOST_CONTAINER:-"$("$PROJECT_ROOT/build/get_container_id.sh")"}"
|
||||
|
||||
DOCKER_RUNCMD=( %DOCKER_RUNCMD% )
|
||||
# shellcheck disable=SC2162
|
||||
read -a ADDITIONAL_RUNFLAGS <<< "$RUNFLAGS"
|
||||
|
||||
set -- "${DOCKER_RUNFLAGS[@]}" "%DOCKER_IMAGE%" "${DOCKER_RUNCMD[@]}" "$@"
|
||||
RUNFLAGS=()
|
||||
|
||||
# shellcheck disable=SC2191
|
||||
RUNFLAGS+=( %RUNFLAGS% )
|
||||
|
||||
if [[ -n "$HOST_CONTAINER" ]]; then
|
||||
RUNFLAGS+=( --volumes-from "$HOST_CONTAINER" )
|
||||
fi
|
||||
|
||||
RUNFLAGS+=( --network "$NETWORK" )
|
||||
|
||||
if [[ -n "$CONTAINER_CGROUP_PARENT" ]]; then
|
||||
RUNFLAGS+=( --cgroup-parent "$CONTAINER_CGROUP_PARENT" )
|
||||
fi
|
||||
|
||||
RUNFLAGS+=( --workdir "$PWD" )
|
||||
|
||||
RUNCMD=( %RUNCMD% )
|
||||
|
||||
set -- "${RUNFLAGS[@]}" "${ADDITIONAL_RUNFLAGS[@]}" "$IMAGE" "${RUNCMD[@]}" "$@"
|
||||
|
||||
exec "$DOCKER" run "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user