From 0db7c5d2f64574b7c225d8abd169d00a8ef37585 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Wed, 18 Jan 2023 15:47:41 +0100 Subject: [PATCH 1/7] Update for 5.1 --- Dockerfile | 31 +++++++++++++++++++------------ README.md | 9 ++++++--- entrypoint.sh | 4 ++-- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1e3240f..26e762a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -# modelio-4.1.0 on Debian-based image +# modelio-5.1.0 on Debian-based image # # WARNING : PLEASE READ README.md # @@ -7,8 +7,7 @@ # https://github.com/mdouchement/docker-zoom-us # https://github.com/sameersbn/docker-skype -#FROM ubuntu:16.04 -FROM openjdk:11.0.12-slim-bullseye +FROM debian:bullseye-slim # Based on that initial version, and Pascal Poizat's #LABEL maintainer="gerald.hameau@gmail.com" @@ -26,15 +25,23 @@ RUN apt-get -qy dist-upgrade RUN apt-get install -qy --no-install-recommends \ wget sudo \ libgtk-3-0 libwebkit2gtk-4.0-37 - -RUN mkdir /modelio && \ - cd /modelio && \ - wget -nv --show-progress --progress=bar:force:noscroll -O modelio.tar.gz https://github.com/ModelioOpenSource/Modelio/releases/download/v4.1.0/Modelio.4.1.0.-.Linux.tar.gz && \ - tar xfz modelio.tar.gz && \ - rm -rf modelio.tar.gz - -RUN mkdir -p /etc/modelio-open-source4.1 -COPY modelio.config /etc/modelio-open-source4.1 + +RUN apt install -qy ca-certificates + +# We don't need to install from sources, since the project distributes a Debian package (which includes the JRE) +# RUN mkdir /modelio && \ +# cd /modelio && \ +# wget -nv --show-progress --progress=bar:force:noscroll -O modelio.tar.gz https://github.com/ModelioOpenSource/Modelio/releases/download/v4.1.0/Modelio.4.1.0.-.Linux.tar.gz && \ +# tar xfz modelio.tar.gz && \ +# rm -rf modelio.tar.gz +RUN wget -nv --show-progress --progress=bar:force:noscroll -O Debian.modelio-open-source5.1_5.1.0_amd64.deb https://github.com/ModelioOpenSource/Modelio/releases/download/v5.1.0/Debian.modelio-open-source5.1_5.1.0_amd64.deb && \ + dpkg -i Debian.modelio-open-source5.1_5.1.0_amd64.deb +# || \ +# apt-get --fix-broken install -qy + + +# RUN mkdir -p /etc/modelio-open-source4.1 +# COPY modelio.config /etc/modelio-open-source4.1 COPY scripts/ /var/cache/modelio/ COPY entrypoint.sh /sbin/entrypoint.sh diff --git a/README.md b/README.md index 8401a22..514ac06 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Introduction -[Modelio](https://www.modelio.org) 4.1.0 in a docker container (for Linux, and maybe for macOS too) +[Modelio](https://www.modelio.org) 5.1.0 in a docker container (for Linux, and maybe for macOS too) The image uses [X11](http://www.x.org) unix domain socket on the host to enable display of the Modelio desktop app. These components are available out of the box on pretty much any modern linux distribution. @@ -35,6 +35,8 @@ docker pull olberger/docker-modelio:latest Alternatively you can build the image yourself, from the contents of the Github repo. + + ```bash docker build -t olberger/docker-modelio github.com/olberger/docker-modelio ``` @@ -89,11 +91,12 @@ Mounting '/home/olivier/Documents/ModelioWorkspace' on the host into '/home/mode Limiting to 2.0 cpus for the container Starting bash inside the container... Inside the running container... -You can now launch Modelio by invoking 'modelio.sh' at the bash prompt, and quit with 'exit' at the end. +You can now launch Modelio by invoking '/usr/bin/modelio-open-source5.1' at the bash prompt, and quit with 'exit' at the end. modelio@9749358c4a9d:~$ ``` -then type `modelio.sh` at the prompt inside the container. +then type `/usr/bin/modelio-open-source5.1` at the prompt inside the +container, as instructed. ## Runtime options diff --git a/entrypoint.sh b/entrypoint.sh index 14e6b1e..9dbbe46 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -58,7 +58,7 @@ grant_access_to_video_devices() { launch_bash() { cd /home/${MODELIO_USER} - echo 'PATH="${PATH}:/modelio/Modelio 4.1/"' > /home/${MODELIO_USER}/.bashrc +# echo 'PATH="${PATH}:/modelio/Modelio 4.1/"' > /home/${MODELIO_USER}/.bashrc # exec sudo -HEu ${MODELIO_USER} PULSE_SERVER=/run/pulse/native QT_GRAPHICSSYSTEM="native" xcompmgr -c -l0 -t0 -r0 -o.00 & # exec sudo -HEu ${MODELIO_USER} PULSE_SERVER=/run/pulse/native QT_GRAPHICSSYSTEM="native" $@ @@ -78,7 +78,7 @@ case "$1" in create_user #grant_access_to_video_devices #echo "$1" - echo "You can now launch Modelio by invoking 'modelio.sh' at the bash prompt, and quit with 'exit' at the end." + echo "You can now launch Modelio by invoking '/usr/bin/modelio-open-source5.1' at the bash prompt, and quit with 'exit' at the end." launch_bash $@ ;; # *) From d9376adbefefc6151d6341bd5a1721ec12957bb3 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Fri, 10 Feb 2023 10:32:25 +0100 Subject: [PATCH 2/7] Bump version according to our branch --- README.md | 28 ++++++++++++++-------------- entrypoint.sh | 2 +- scripts/modelio-wrapper | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 27fc6b9..a0c9bae 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ OpenJDK 11 is installed, inside the container in `/usr/local/openjdk-11` (for us Automated builds of the image are available on [Dockerhub](https://hub.docker.com/r/olberger/docker-modelio) and is the recommended method of installation. ```bash -docker pull olberger/docker-modelio:4.1 +docker pull olberger/docker-modelio:5.1 ``` Alternatively you can build the image yourself, from the contents of @@ -38,8 +38,8 @@ the Github repo. ```bash -docker rmi olberger/docker-modelio:4.1 -docker build -t olberger/docker-modelio:4.1 github.com/olberger/docker-modelio#4.1 +docker rmi olberger/docker-modelio:5.1 +docker build -t olberger/docker-modelio:5.1 github.com/olberger/docker-modelio#5.1 ``` With the image locally available, install the wrapper script by running the following as root: @@ -47,10 +47,10 @@ With the image locally available, install the wrapper script by running the foll ```bash docker run -it --rm \ --volume /usr/local/bin:/target \ - olberger/docker-modelio:4.1 install + olberger/docker-modelio:5.1 install ``` -This will install a wrapper script named `modelio-wrapper-4.1` to +This will install a wrapper script named `modelio-wrapper-5.1` to launch Modelio inside a container (details and options below). ## Setup on Mac (perform once) @@ -80,12 +80,12 @@ THIS SECTION WASN'T TESTED AND SHOULD BE CHECKED. PULL REQUESTS WELCOME ## Starting Modelio -Launch the `modelio-wrapper-4.1` script to enter a shell inside the +Launch the `modelio-wrapper-5.1` script to enter a shell inside the Docker container (or directly `modelio` if you don't have multiple versions installed): ```bash -modelio-wrapper-4.1 bash +modelio-wrapper-5.1 bash ``` Then the prompt should be displayed like: @@ -143,12 +143,12 @@ Then launch modelio (twice if it triggers an error at first launch) ## Updating -To update to a newer release of the container image, for Modelio 4.1: +To update to a newer release of the container image, for Modelio 5.1: 1. Download the updated Docker image: ```bash - docker pull olberger/docker-modelio:4.1 + docker pull olberger/docker-modelio:5.1 ``` 2. Run `install` to make sure the host scripts are updated. @@ -156,7 +156,7 @@ To update to a newer release of the container image, for Modelio 4.1: ```bash docker run -it --rm \ --volume /usr/local/bin:/target \ - olberger/docker-modelio:4.1 install + olberger/docker-modelio:5.1 install ``` ## Upgrading @@ -169,13 +169,13 @@ Modelio, check the repository's master branch instructions. ```bash docker run -it --rm \ --volume /usr/local/bin:/target \ - olberger/docker-modelio:4.1 uninstall + olberger/docker-modelio:5.1 uninstall ``` ## Local image rebuild ```bash -docker build --tag olberger/docker-modelio:4.1 . +docker build --tag olberger/docker-modelio:5.1 . ``` ## Run without installation @@ -198,7 +198,7 @@ some values of CPU usage: * 3.0 : convenient * 4.0 : comfortable -Adjust the `-c` option passed to the `modelio-wraper-4.1`, depending on your needs. +Adjust the `-c` option passed to the `modelio-wraper-5.1`, depending on your needs. ## Contributing @@ -214,7 +214,7 @@ The wrapper scripts mounts the X11 socket in the launcher container (a Docker vo When the image is launched the following directories are mounted as volumes: -- `~/.modelio-4.1/`, or `${MODELIO_HOME}/.modelio-4.1/` if option `-p` is +- `~/.modelio-5.1/`, or `${MODELIO_HOME}/.modelio-5.1/` if option `-p` is provided, or a value of `MODELIO_HOME` is defined - `~/Documents/ModelioWorkspace/` (where `Documents` is determined through `XDG_DOCUMENTS_DIR`), or similarly `${MODELIO_HOME}/Documents/ModelioWorkspace/` diff --git a/entrypoint.sh b/entrypoint.sh index 048455c..2178320 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -6,7 +6,7 @@ set -e #set -x -MODELIO_VERSION=4.1 +MODELIO_VERSION=5.1 MODELIO_WRAPPER=modelio-wrapper-$MODELIO_VERSION USER_UID=${USER_UID:-1000} diff --git a/scripts/modelio-wrapper b/scripts/modelio-wrapper index 09a2ba6..e7b1fec 100755 --- a/scripts/modelio-wrapper +++ b/scripts/modelio-wrapper @@ -4,7 +4,7 @@ #set -x -MODELIO_VERSION=4.1 +MODELIO_VERSION=5.1 DOCKERIMAGE=olberger/docker-modelio:$MODELIO_VERSION From b69aa474988cc249df3b2facf13e923595211f93 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Fri, 10 Feb 2023 10:38:06 +0100 Subject: [PATCH 3/7] Details on multiple versions --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index a0c9bae..bb1631f 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,14 @@ To update to a newer release of the container image, for Modelio 5.1: To update to a release of the container image for a later version of Modelio, check the repository's master branch instructions. +## Running previous versions + +See https://github.com/olberger/docker-modelio/tree/4.1 for +instructions on running a container for Modelio 4.1. + +Running multiple versions alongside in separate containers should be +possible, but test this at your own risks. + ## Uninstallation ```bash From d1a44e2e7f0f350e984bd4344d8fe2fbb5d73f06 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Fri, 10 Feb 2023 11:06:20 +0100 Subject: [PATCH 4/7] Improved handling of the xauth stuff Kudos to http://jrper.github.io/2018/04/12/XWindowsAndDocker.html for some bits --- scripts/modelio-wrapper | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/modelio-wrapper b/scripts/modelio-wrapper index e7b1fec..138b8f3 100755 --- a/scripts/modelio-wrapper +++ b/scripts/modelio-wrapper @@ -26,7 +26,7 @@ USER_UID=$(id -u) USER_GID=$(id -g) XSOCK=/tmp/.X11-unix -XAUTH=/tmp/.docker.xauth +XAUTH=/tmp/.docker.xauth.$USER.$$ # DOWNLOAD_DIR=$(xdg-user-dir DOWNLOAD) # if [ -z "${DOWNLOAD_DIR}" ]; then @@ -73,7 +73,7 @@ prepare_docker_env_parameters() { prepare_docker_volume_parameters() { touch ${XAUTH} - xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f ${XAUTH} nmerge - + xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f ${XAUTH} nmerge - if [[ -z "${MODELIO_HOME}" ]]; then MODELIO_HOME=${HOME} # Default directory @@ -102,8 +102,8 @@ prepare_docker_volume_parameters() { VOLUMES+=" --volume=${DOCUMENTS_DIR}/ModelioWorkspace:/home/${MODELIO_USER}/modelio/workspace" echo "Mounting '${DOCUMENTS_DIR}/ModelioWorkspace' on the host into '/home/${MODELIO_USER}/modelio/workspace' on the guest" - VOLUMES+=" --volume=${XSOCK}:${XSOCK}" - VOLUMES+=" --volume=${XAUTH}:${XAUTH}" + VOLUMES+=" --volume=${XSOCK}:${XSOCK}:rw" + VOLUMES+=" --volume=${XAUTH}:${XAUTH}:rw" # VOLUMES+=" --volume=/run/user/${USER_UID}/pulse:/run/pulse" } @@ -207,5 +207,7 @@ ${SUDO} docker run -it \ #>/dev/null +rm -f $XAUTH + # Never displayed cause of exec echo "Container execution terminated." From 37fbbf04187634c6e239305b98f36775d815e3b6 Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Fri, 10 Feb 2023 11:06:53 +0100 Subject: [PATCH 5/7] Typo --- scripts/modelio-wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modelio-wrapper b/scripts/modelio-wrapper index 138b8f3..2b2db69 100755 --- a/scripts/modelio-wrapper +++ b/scripts/modelio-wrapper @@ -83,7 +83,7 @@ prepare_docker_volume_parameters() { #DOWNLOAD_DIR=${DOWNLOAD_DIR/$HOME/$MODELIO_HOME} DOCUMENTS_DIR=${DOCUMENTS_DIR/$HOME/$MODELIO_HOME} #mkdir -p ${DOWNLOAD_DIR} - mkdir -p ${SOCUMENTS_DIR} + mkdir -p ${DOCUMENTS_DIR} # mkdir -p ${MODELIO_HOME}/{.config,.cache} mkdir -p ${MODELIO_HOME}/.modelio-$MODELIO_VERSION From dcb9647b9dd366ecbb016b7a2537dc27f6b1d54d Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Fri, 10 Feb 2023 11:09:47 +0100 Subject: [PATCH 6/7] Do not depend on xdg-user-dir presence Try and fix #2 --- scripts/modelio-wrapper | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/modelio-wrapper b/scripts/modelio-wrapper index 2b2db69..b6b8081 100755 --- a/scripts/modelio-wrapper +++ b/scripts/modelio-wrapper @@ -32,7 +32,8 @@ XAUTH=/tmp/.docker.xauth.$USER.$$ # if [ -z "${DOWNLOAD_DIR}" ]; then # DOWNLOAD_DIR="${HOME}/Downloads" # fi; -DOCUMENTS_DIR=$(xdg-user-dir DOCUMENTS) +# xdg-user-dir may not be available on Mac OS... until better solution, use a fixed dir +DOCUMENTS_DIR=$(xdg-user-dir DOCUMENTS || true) if [ -z "${DOCUMENTS_DIR}" ]; then DOCUMENTS_DIR="${HOME}/Documents" fi; From 2a2a37c5411fcf7a39853326424f993de839594f Mon Sep 17 00:00:00 2001 From: Olivier Berger Date: Fri, 10 Feb 2023 11:14:34 +0100 Subject: [PATCH 7/7] Change default to 3 cpus Fixes #3 --- scripts/modelio-wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/modelio-wrapper b/scripts/modelio-wrapper index b6b8081..3195df2 100755 --- a/scripts/modelio-wrapper +++ b/scripts/modelio-wrapper @@ -14,7 +14,7 @@ CONTAINER_NAME=modelio-$MODELIO_VERSION # * 2.0 : slow # * 3.0 : convenient # * 4.0 : comfortable -CPUS=2.0 +CPUS=3.0 PATH=/usr/sbin:/usr/bin:/sbin:/bin MODELIO_USER=modelio