Comprobado en gentoo que van docker y podman

This commit is contained in:
Jaime 2026-02-01 16:48:58 +01:00
parent 6fe64c1d85
commit 046c267e13

View file

@ -1,6 +1,10 @@
#!/bin/bash
set -e
set -x
BUILDCACHE=./.build-container-cache
detect_container(){
@ -20,11 +24,15 @@ detect_container(){
}
clean_build_cache(){
if [ -d $BUILDCACHE ]; then rm -r $BUILDCACHE; fi
if [ -d .dart_tool ]; then rm -r .dart_tool; fi
if [ -d build ]; then rm -r build; fi
$DOCKER builder prune --all --force
}
build_image(){
$DOCKER build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) --progress=plain -t d4rt-formulas-builder -f Dockerfile .
# docker doesnt support --progress=PLAIN
$DOCKER build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t d4rt-formulas-builder -f Dockerfile .
}
graphic_options(){
@ -37,12 +45,13 @@ graphic_options(){
[ "$XDG_SESSION_TYPE" = "wayland" ] || [ "$WAYLAND_DISPLAY" != "" ]
}
if is_x11
# DISPLAY IS ALSO DEFINED IN WAYLAND, SO TEST WAYLAND FIRST
if is_wayland
then
echo "--env=XDG_RUNTIME_DIR=/run/user/$(id -u) --volume=/run/user/$(id -u)/$WAYLAND_DISPLAY:/run/user/$(id -u)/$WAYLAND_DISPLAY --group-add=video"
elif is_x11
then
echo "--env DISPLAY=$DISPLAY --volume /tmp/.X11-unix:/tmp/.X11-unix --security-opt=label=disable"
elif is_wayland
then
echo "--env=XDG_RUNTIME_DIR=/run/user/$(id -u) --volume=/run/user/$(id -u)/wayland:/run/user/$(id -u)/wayland --group-add=video"
else
echo "WARNING: no graphic environment" 1>&2
fi
@ -64,18 +73,25 @@ spi_options(){
fi
}
docker_options(){
if [ "$DOCKER" = "podman" ]
then
printf " %s " "--userns=keep-id"
fi
}
exec_in_container(){
SPIOPTIONS=$(spi_options)
local SPIOPTIONS=$(spi_options)
local GRAPHICOPTIONS=$(graphic_options)
local BUILDCACHE=./.build-container-cache
local DOCKEROPTIONS=$(docker_options)
mkdir -p $BUILDCACHE
$DOCKER run \
-it \
--userns=keep-id \
--user $(id -u):$(id -g) \
--init \
--rm \
$DOCKEROPTIONS \
$GRAPHICOPTIONS \
$SPIOPTIONS \
-p ${WEBPORT:-8081}:8081 \