1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

fixes run in dind setup

This commit is contained in:
nosamad 2019-04-02 18:36:38 +02:00
parent a8f20eccf9
commit fa0ae1c66e
3 changed files with 39 additions and 16 deletions

View File

@ -113,8 +113,6 @@ DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
DOCKER_RUNFLAGS += --env BUILDTIME
DOCKER_RUNFLAGS += --env NINJA_STATUS
DOCKER_RUNFLAGS += $(addprefix --volumes-from ,$(HOST_CONTAINER))
DOCKER_RUNFLAGS += $(addprefix --cgroup-parent ,$(CONTAINER_CGROUP_PARENT))
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
@ -148,13 +146,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
@ -212,10 +213,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 $@

View File

@ -41,6 +41,7 @@ fi
{
echo '#include <...> search starts here:'
# shellcheck disable=SC1117
sed -n -e "s@\(.*\)@$INCLUDE_DIRS_PREFIX\1@p" "$INCLUDE_DIRS_TMPFILE"
echo 'End of search list.'
} > "$INCLUDE_DIRS_FILE"

View File

@ -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 "$@"