项目作者: kmaehashi

项目描述 :
Run Xojo on Docker
高级语言: Dockerfile
项目地址: git://github.com/kmaehashi/xojo-docker.git
创建时间: 2019-10-22T14:31:03Z
项目社区:https://github.com/kmaehashi/xojo-docker

开源协议:

下载


Xojo on Docker

Docker images to run Xojo IDE and desktop apps.
Images are hosted on Docker Hub.

Usage

Via X11 Forwarding

First connect to a Linux host running Docker with SSH X11 forwarding enabled.

  1. ssh -Y host

Then start the container to run Xojo IDE.

  1. docker run \
  2. --rm \
  3. --net host \
  4. --env DISPLAY \
  5. --volume ~/.Xauthority:/root/.Xauthority \
  6. kmaehashi/xojo-docker:xojo2022r11-ubuntu20.04

Notes:

  • --net host: The container shares the same network namespace as the Docker host.
    This is mandatory to connect to a TCP port for X11 forwarding from the container, as the port only binds to localhost of the Docker host.
  • --env DISPLAY: X11 applications (i.e., Xojo IDE) use this information to know the TCP port for X11 forwarding.
  • --volume ~/.Xauthority:/root/.Xauthority: X11 applications inside the container use this file as the authorization cookie to the forwarded X11 server.

Remote Debugger can also be run inside the container.

  1. docker run \
  2. --rm \
  3. --net host \
  4. --env DISPLAY \
  5. --volume ~/.Xauthority:/root/.Xauthority \
  6. kmaehashi/xojo-docker:xojo2022r11-ubuntu20.04 \
  7. "/opt/xojo/xojo/Extras/Remote Debugger Desktop/Remote Debugger Desktop 64-Bit/Remote Debugger Desktop"

To run your application instead of the IDE, specify the application path as an argument.
You can use desktop-runtime image, which provides smaller footprint than xojo-{VERSION} images.

  1. docker run \
  2. --rm \
  3. --net host \
  4. --env DISPLAY \
  5. --volume ~/.Xauthority:/root/.Xauthority \
  6. --volume /local/path/to/app_dir:/container/path/to/app_dir \
  7. kmaehashi/xojo-desktop-runtime:ubuntu20.04 \
  8. /container/path/to/app_dir/app

Hints:

  • Make sure that xauth command is available on the Docker host when using SSH X11 forwarding.
  • SELinux may prevent accessing .Xauthority from inside Docker containers.
  • Containers launched using the docker command line above are volatile as --rm option is specified.
    Consider specifying additional volumes to keep your Xojo configuration and projects outside of the container.
    The IDE stores preferences (including licenses) under /root.
  • /opt/xojo/xojo is a symbolic link to the current Xojo root directory (e.g., /opt/xojo/xojo/xojo2019r2).
  • To install additional plugins you will need a custom Dockerfile based on xojo-VERSION image.
    Place plugin files (*.xojo_plugin) under /opt/xojo/xojo/Plugins/.

Headless Mode

You can run your desktop application in headless (no-display) mode for e.g. testing purposes or contiguous integration systems.
Before starting your application you need to source the headless script, which internally configures a virtual X11 server (Xvfb).

  1. docker run \
  2. --rm \
  3. --volume /local/path/to/app_dir:/container/path/to/app_dir \
  4. kmaehashi/xojo-desktop-runtime:ubuntu20.04 \
  5. bash -c 'source /headless; /container/path/to/app_dir/app'

Hints:

  • Use System.DebugLog method in Desktop apps to print to the standard output.
  • You can access the command line arguments via /proc/self/cmdline, e.g.:
  1. Public Function Arguments() as String()
  2. Var ret() As String
  3. #if TargetLinux And TargetDesktop
  4. Var s As TextInputStream = TextInputStream.Open(New FolderItem("/proc/self/cmdline"))
  5. Try
  6. Var chunks() As String
  7. While True
  8. Var buf As String = s.Read(12)
  9. If buf.Length = 0 Then Exit
  10. chunks.Append(buf)
  11. Wend
  12. ret = String.FromArray(chunks, "").Split(Chr(0))
  13. Finally
  14. s.Close()
  15. End Try
  16. #endif
  17. Return ret
  18. End Function

Debug-Running Projects

Debug-run your application inside the Docker container, using the project source code and Xojo IDE.

  1. cat _EOF_ | nc -U /tmp/XojoIDE
  2. OpenFile("/path/to/project")
  3. DoCommand("RunApp")
  4. _EOF_