Compare commits

...

11 Commits

Author SHA1 Message Date
8fbec958ed - Fix Application Dir spaces support. 2025-04-21 12:26:02 +02:00
3b58d3e99d - Add glinfo command. 2025-04-14 18:17:30 +02:00
5dfd1063e4 - Add absolute & relative command path support,
- Add spaces support in Application Dir & Command.
2025-04-14 14:14:02 +02:00
5ab68d4e8e - Use now rx3-docker/base:1.3.2-mga9 image,
- Add "urpmi.update -a" to force mirror sync.
2025-04-13 11:10:59 +02:00
15fedccb99 - Use now rx3-docker/base:1.3.1-mga9 image,
- Fix some env.dist variables,
- Improve network naming.
2025-03-08 19:05:51 +01:00
1ec6476ff6 - Move & Rename repo from Rx3/X11-Pulse-MGA9 to Rx3-Docker/X11-Pulse,
- New version naming standard,
- Now use docker_tools for .env building,
- Now use docker_service_add macro,
- Use now rx3-docker/base:1.3.0-mga9 image,
- Create src bin & dir/sbin directories.
2024-11-18 00:09:46 +01:00
77bb7d9185 - Update to rx3/base-mga9:1.2.6 image,
- Variabilization of external server ports in env & compose file,
- Now use docker_tools for .env building.
2024-10-07 15:19:00 +02:00
e795826ec4 - Update to base-mga9:1.2.4 image. 2024-08-28 18:24:40 +02:00
433fd789a4 - Update to base-mga9:1.2.3 image. 2024-08-27 01:25:14 +02:00
502680793e - Update to base-mga9:1.2.1 image,
- Minor compose file updates.
2024-08-25 00:47:59 +02:00
6017327425 - Add internet output routing option on run time execution,
- Fix application args passing.
2024-08-23 17:42:22 +02:00
10 changed files with 328 additions and 110 deletions

11
.env
View File

@ -1,11 +0,0 @@
# Rx3 X11 Pulse Mageia-9 Docker Image
#-------------------------------------------------------------------------------
IMG_NAME="x11-pulse-mga9"
IMG_FULL_NAME="Rx3 X11 Pulse Mageia-9 Docker Image"
IMG_VERSION="1.1.0"
IMG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
# To be difines at run time
USER_ID=""
APPL_HOME_DIR=""

View File

@ -1,27 +1,29 @@
# Rx3 X11 Pulse Mageia-9 Docker Image # Rx3-Docker/X11-Pulse Docker Image
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
FROM docker.xor.rx3:5000/rx3/base-mga9:1.2.0 ARG IMG_FROM_URL="rx3-docker/base:latest"
FROM ${IMG_FROM_URL}
ARG IMG_NAME ARG IMG_NAME
ARG IMG_FULL_NAME ARG IMG_NAME_FULL
ARG IMG_VERSION ARG IMG_VERSION
ARG IMG_MAINTAINER ARG IMG_MAINTAINER
LABEL org.rx3.${IMG_NAME}.name=${IMG_FULL_NAME} LABEL org.rx3.${IMG_NAME}.name=${IMG_NAME_FULL}
LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION} LABEL org.rx3.${IMG_NAME}.version=${IMG_VERSION}
LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER} LABEL org.rx3.${IMG_NAME}.maintainer=${IMG_MAINTAINER}
LABEL maintainer=${IMG_MAINTAINER} LABEL maintainer=${IMG_MAINTAINER}
ENV DISPLAY=:0 ENV DISPLAY=:0
RUN urpmi --force xterm lib64jack0 lib64opencl1 pipewire-media-session lib64proxy-webkit hunspell-en lib64xcb-xkb1 lib64xcomposite1 lib64xcursor1 lib64xdamage1 lib64xft-gir2.0 lib64xi6 lib64xinerama1 lib64xkbcommon0 lib64vulkan-loader1 lib64xlib-gir2.0 lib64xrandr2 lib64xmlb2 lib64xslt1 libexif12-common libgxps-tools frozen-bubble RUN urpmi.update -a \
&& urpmi --force xterm lib64jack0 lib64opencl1 pipewire-media-session lib64proxy-webkit hunspell-en lib64xcb-xkb1 lib64xcomposite1 lib64xcursor1 lib64xdamage1 lib64xft-gir2.0 lib64xi6 lib64xinerama1 lib64xkbcommon0 lib64vulkan-loader1 lib64xlib-gir2.0 lib64xrandr2 lib64xmlb2 lib64xslt1 libexif12-common libgxps-tools frozen-bubble glxinfo
#RUN passwd -d root #RUN passwd -d root
COPY /sbin/user_add_exec /sbin COPY src/sbin/user_add_exec /usr/local/sbin
VOLUME /home VOLUME /home
VOLUME /tmp/.X11-unix/X0 VOLUME /tmp/.X11-unix/X0

View File

@ -1,17 +1,18 @@
Welcome to X11-Pulse-Mga9 docker image! Welcome to RX3-Docker/X11-Pulse docker image!
This is project aims to build a X11 + Pulse + Mageia-9 docker image able to run any graphic & audio application isolated. This is project aims to build a X11 + Pulse docker image able to run any graphic & audio application isolated.
Features: Features:
- Curtently based on base-mga9:1.2.0 image, - Curtently based on rx3-docker/base:1.3.2-mga9 image,
- X11 & Pulse base libraries installed, - X11 & Pulse base libraries installed,
- user_add_exec program to create on the run the user environement. - Target user & group created on the run,
- Optional output internet routing.
Usage: Usage:
./run.sh <Application Dir> <Application Exec> ./bin/run.sh [-h] [-i] <Application Dir> <Application Exec> [Args...]
Enjoy it! Enjoy it!
@ -20,4 +21,4 @@ Your Rx3 Team.
-- --
arnaud@rx3.net arnaud@rx3.net
https://git.rx3.org/gitea/rx3/x11-pulse-mga9 https://git.rx3.org/gitea/rx3-docker/x11-pulse

View File

@ -1,5 +1,99 @@
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
X11-Pulse-Mga9 V 1.1.0 - A. GIBERT - 2024/08/23 Rx3-Docker/X11-Pulse V 1.2.4 - A. GIBERT - 2025/04/21
------------------------------------------------------------------------------------------------------------------------------------
- Fix Application Dir spaces support.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/X11-Pulse V 1.2.3 - A. GIBERT - 2025/04/14
------------------------------------------------------------------------------------------------------------------------------------
- Add absolute & relative command path support,
- Add spaces support in Application Dir & Command,
- Add glinfo command.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/X11-Pulse V 1.2.2 - A. GIBERT - 2025/04/13
------------------------------------------------------------------------------------------------------------------------------------
- Use now rx3-docker/base:1.3.2-mga9 image,
- Add "urpmi.update -a" to force mirror sync.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/X11-Pulse V 1.2.1 - A. GIBERT - 2025/03/08
------------------------------------------------------------------------------------------------------------------------------------
- Use now rx3-docker/base:1.3.1-mga9 image,
- Fix some env.dist variables,
- Improve network naming.
------------------------------------------------------------------------------------------------------------------------------------
Rx3-Docker/X11-Pulse V 1.2.0 - A. GIBERT - 2024/11/18
------------------------------------------------------------------------------------------------------------------------------------
- Move & Rename repo from Rx3/X11-Pulse-MGA9 to Rx3-Docker/X11-Pulse,
- New version naming standard,
- Now use docker_tools for .env building,
- Now use docker_service_add macro,
- Use now rx3-docker/base:1.3.0-mga9 image,
- Create bin & src/sbin directories.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/X11-Pulse-Mga9 V 1.1.5 - A. GIBERT - 2024/10/07
------------------------------------------------------------------------------------------------------------------------------------
- Update to rx3/base-mga9:1.2.6 image,
- Variabilization of external server ports in env & compose file,
- Now use docker_tools for .env building.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/X11-Pulse-Mga9 V 1.1.4 - A. GIBERT - 2024/08/28
------------------------------------------------------------------------------------------------------------------------------------
- Update to rx3/base-mga9:1.2.4 image.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/X11-Pulse-Mga9 V 1.1.3 - A. GIBERT - 2024/08/27
------------------------------------------------------------------------------------------------------------------------------------
- Update to rx3/base-mga9:1.2.3 image.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/X11-Pulse-Mga9 V 1.1.2 - A. GIBERT - 2024/08/25
------------------------------------------------------------------------------------------------------------------------------------
- Update to rx3/base-mga9:1.2.1 image.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/X11-Pulse-Mga9 V 1.1.1 - A. GIBERT - 2024/08/23
------------------------------------------------------------------------------------------------------------------------------------
- Add internet output routing option on run time execution,
- Fix application args passing.
------------------------------------------------------------------------------------------------------------------------------------
Rx3/X11-Pulse-Mga9 V 1.1.0 - A. GIBERT - 2024/08/23
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Remove Emacs to lighten the image weight... - Remove Emacs to lighten the image weight...
@ -7,10 +101,10 @@ X11-Pulse-Mga9 V 1.1.0 - A. GIBERT - 2024/08/23
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
X11-Pulse-Mga9 V 1.0.0 - A. GIBERT - 2024/08/23 Rx3/X11-Pulse-Mga9 V 1.0.0 - A. GIBERT - 2024/08/23
------------------------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------------------------
- Initial release, - Initial release,
- Use based on base-mga9:1.2.0 image, - Based on rx3/base-mga9:1.2.0 image,
- X11 & Pulse ready, - X11 & Pulse ready,
- user_add_exec installed. - user_add_exec installed.

48
bin/run.sh Executable file
View File

@ -0,0 +1,48 @@
#!/bin/bash
set -o errexit
APPL_HOME_DIR="$(dirname "$(dirname "$0")")"
#-------------------------------------------------------------------------------
if [[ "$1" == "-h" ]]
then
echo "usage: run.sh [-h] [-i] <Application_Dir> <Application_Exec> [Args...]"
echo "with -i enabling internet access."
exit 0
fi
if [[ "$1" == "-i" ]]
then
shift;
export APPL_NETWORK="internet"
else
export APPL_NETWORK="no-internet"
fi
export APPL_DIR="$1"
shift
export APPL_NAME="$1"
shift
APPL_DIR=$(realpath "${APPL_DIR}")
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
export GROUP_NAME=$(id -gn)
cd "${APPL_HOME_DIR}"
sbin/docker_mk_env
docker compose run --rm x11-pulse /usr/local/sbin/user_add_exec ${USER_ID} ${USER} ${HOME} ${GROUP_ID} ${GROUP_NAME} "${APPL_DIR}" "${APPL_NAME}" "$@"
docker compose down

View File

@ -1,40 +1,68 @@
# Rx3 X11 Pulse Mageia-9 Docker Image # Rx3-Docker/X11-Pulse Docker Image
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
name: ${IMG_NAME} name: ${XP_IMG_NAME}
services: services:
default:
container_name: ${IMG_NAME} #-------------------------------------------------------------------------------
image: docker.xor.rx3:5000/rx3/${IMG_NAME}:${IMG_VERSION}
x11-pulse:
container_name: ${XP_HOST_NAME}
hostname: ${XP_HOST_NAME}
image: ${XP_IMG_URL}
build: build:
context: . context: .
args: args:
- IMG_NAME=${IMG_NAME} IMG_NAME: ${XP_IMG_NAME}
- IMG_FULL_NAME=${IMG_FULL_NAME} IMG_NAME_FULL: ${XP_IMG_NAME_FULL}
- IMG_VERSION=${IMG_VERSION} IMG_VERSION: ${XP_IMG_VERSION}
- IMG_MAINTAINER=${IMG_MAINTAINER} IMG_MAINTAINER: ${XP_IMG_MAINTAINER}
IMG_FROM_URL: ${XP_IMG_FROM_URL}
restart: unless-stopped restart: unless-stopped
environment: environment:
- DISPLAY=:0 DISPLAY: ":0"
volumes: volumes:
- home_dir:/home # - home_dir:/home
- type: bind - /opt/vm/home:/home
source: /tmp/.X11-unix/X0 - type: bind
target: /tmp/.X11-unix/X0 source: /tmp/.X11-unix/X0
- type: bind target: /tmp/.X11-unix/X0
source: /run/user/${USER_ID}/pulse - type: bind
target: /run/user/${USER_ID}/pulse source: /run/user/${USER_ID}/pulse
- type: bind target: /run/user/${USER_ID}/pulse
source: ${APPL_HOME_DIR} - type: bind
target: ${APPL_HOME_DIR} source: "${APPL_DIR}"
target: "${APPL_DIR}"
networks:
- ${APPL_NETWORK}
network_mode: bridge
volumes: volumes:
home_dir: home_dir:
external: true external: true
#-------------------------------------------------------------------------------
networks:
internet:
name: ${NETWORK_NAME}-internet
driver: bridge
internal: false # Allow internet access
driver_opts:
com.docker.network.bridge.name: ${NETWORK_IF_NAME}
no-internet:
name: ${NETWORK_NAME}-no-internet
driver: bridge
internal: true # Block internet access
driver_opts:
com.docker.network.bridge.name: ${NETWORK_IF_NAME}

59
env.dist Normal file
View File

@ -0,0 +1,59 @@
# Rx3-Docker/X11-Pulse Docker Image
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Global Settings
#-------------------------------------------------------------------------------
ORG_NAME="rx3-docker"
ORG_REGISTRY="docker.xor.rx3:5000"
ORG_MAINTAINER='"Arnaud G. GIBERT" <arnaud@rx3.net>'
ORG_URL_PREFIX="${ORG_REGISTRY}/${ORG_NAME}"
#-------------------------------------------------------------------------------
# Image Settings
#-------------------------------------------------------------------------------
APPL_NAME="x11-pulse"
APPL_NAME_FULL="X11-Pulse Docker Image"
APPL_NAME_SHORT="x11-pulse"
APPL_VERSION="1.2.4"
HOST_NAME_PREFIX=${APPL_NAME_SHORT}${APPL_SUFFIX}
PORT_ENV_OFFSET=0
PORT_SV_INT=9001
PORT_SV_OFFSET=1000
NETWORK_NAME=${HOST_NAME_PREFIX}
NETWORK_IF_NAME=br-${NETWORK_NAME}
DOCKER_TOOLS_DEBUG=FALSE
DOCKER_TOOLS_VOLUME=SINGLE
#DOCKER_TOOLS_VOLUME=MIXED
#DOCKER_TOOLS_VOLUME=MERGED
#DOCKER_TOOLS_VOLUME=SPLIT
#DOCKER_TOOLS_EXEPTION_LIBS="postgres:pgsql"
#------------------+----------+--------------------------+--------------------+------------------+-------------------------------+---------------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
# | Variable | Service | Target Image | From Image | Module | Main Port | Admin Port | User | Group |
# | Prefix | Name | URL Prefix | Name | Name Full | Version | URL Prefix | Name | Version | Name | Version | Ext | Int | Ext | Int | Name / Id | Name / Id |
#------------------+----------+--------------------------+--------------------+------------------+-------------------------------+---------------------+--------------------+---------------+------------+--------------+------------+-------+-------+-------+-------+--------------+--------------+
docker_service_add XP x11-pulse ${ORG_URL_PREFIX} - "Rx3-Docker/X11-Pulse" ${APPL_VERSION}-mga9 ${ORG_URL_PREFIX} base 1.3.2-mga9 - - - - - - - -
#-------------------------------------------------------------------------------
# User Settings (overwrited at run time)
#-------------------------------------------------------------------------------
USER_ID=""
APPL_DIR=""
APPL_NETWORK="no-internet"

16
run.sh
View File

@ -1,16 +0,0 @@
#!/bin/bash
export APPL_HOME_DIR="$1"
shift
export APPL_NAME="$1"
shift
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
export GROUP_NAME=$(id -gn)
docker compose run --rm default /sbin/user_add_exec ${USER_ID} ${USER} ${HOME} ${GROUP_ID} ${GROUP_NAME} ${APPL_HOME_DIR}/${APPL_NAME} $*

View File

@ -1,42 +0,0 @@
#!/bin/bash
for arg in User_Id User_Name Home_Dir Group_Id Group_Name
do
declare "$arg"=$1
shift
done
echo "User Add & Exec: User_Id: (${User_Id}) User_Name: [${User_Name}] Home_Dir: [${Home_Dir}] Group_Id: (${Group_Id}) Group_Name: [${Group_Name}]"
echo " Display: [${DISPLAY}] Cmd: [${*}]"
echo ""
echo "Creating group..."
groupadd --gid ${Group_Id} ${Group_Name}
echo "Creating user..."
if [[ ! -d ${Home_Dir} ]]
then
home_opts="--create-home"
fi
useradd 2>/dev/null --uid ${User_Id} --gid ${Group_Id} -m --home-dir ${Home_Dir} ${home_opts} --password "" ${User_Name}
echo "Update global profile..."
echo -e "export DISPLAY=${DISPLAY}\nexport XDG_RUNTIME_DIR=/run/user/${User_Id}" >/etc/profile.d/x11.sh
chown ${User_Name}:${Group_Name} /run/user/${User_Id}
echo "Exec Cmd..."
su - -P ${User_Name} -c $*
echo "Completed!"

55
src/sbin/user_add_exec Executable file
View File

@ -0,0 +1,55 @@
#!/bin/bash
for arg in User_Id User_Name Home_Dir Group_Id Group_Name Appl_Dir
do
declare "$arg"="$1"
shift
done
Cmd=$( printf " %q" "$@" | sed -e 's/^ //' -e 's/\\;/;/g')
echo "User Add & Exec: User_Id: (${User_Id}) User_Name: [${User_Name}] Home_Dir: [${Home_Dir}] Group_Id: (${Group_Id}) Group_Name: [${Group_Name}] Appl_Dir: [${Appl_Dir}]"
echo -n " Display: [${DISPLAY}] Cmd: [${Cmd}]"
#i=2
#while [[ $i -le $# ]]
#do
# echo -n " [${!i}]"
# i=$(($i + 1))
#done
echo ""
echo ""
echo "Creating group..."
groupadd --gid ${Group_Id} ${Group_Name}
echo "Creating user..."
if [[ ! -d ${Home_Dir} ]]
then
home_opts="--create-home"
fi
useradd 2>/dev/null --uid ${User_Id} --gid ${Group_Id} -m --home-dir ${Home_Dir} ${home_opts} --password "" ${User_Name}
echo "Update global profile..."
echo -e "export DISPLAY=${DISPLAY}\nexport XDG_RUNTIME_DIR=/run/user/${User_Id}" >/etc/profile.d/x11.sh
chown ${User_Name}:${Group_Name} /run/user/${User_Id}
echo "Exec Cmd..."
#echo "su - -P ${User_Name} -c \"$*\""
su - -P ${User_Name} -c "cd \"${Appl_Dir}\"; ${Cmd}"
echo "Completed!"