diff --git a/shiny-simple-example/Dockerfile b/shiny-simple-example/Dockerfile index 33e37f1..050daf6 100644 --- a/shiny-simple-example/Dockerfile +++ b/shiny-simple-example/Dockerfile @@ -58,4 +58,4 @@ ENTRYPOINT ["/usr/bin/connect-client", "--entrypoint"] # 4) Command: Run your Shiny app via micromamba # --------------------------------------------------------------- # The port is set by CONNECT_TOOL_PORT environment variable -CMD ["micromamba", "run", "-n", "shiny", "R", "-e", "shiny::runApp('/app/app_plot_demo.R', host='0.0.0.0', port=as.integer(Sys.getenv('CONNECT_TOOL_PORT')))"] \ No newline at end of file +CMD ["micromamba", "run", "-n", "shiny", "R", "-e", "shiny::runApp('/app/app_plot_demo.R', host='0.0.0.0', port=as.integer(Sys.getenv('CONNECT_TOOL_PORT')))"] diff --git a/xpra-igv/Dockerfile b/xpra-igv/Dockerfile new file mode 100644 index 0000000..058bfa3 --- /dev/null +++ b/xpra-igv/Dockerfile @@ -0,0 +1,113 @@ +# Add a default Connect client version. Can be overridden by build arg +ARG CONNECT_CLIENT_VERSION="0.8" + +# Path to the public connect-client +FROM public.cr.seqera.io/platform/connect-client:${CONNECT_CLIENT_VERSION} AS connect + +FROM mambaorg/micromamba:1.5.10-noble AS micromamba + +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive + +ARG MAMBA_USER=root +ARG MAMBA_USER_ID=0 +ARG MAMBA_USER_GID=0 +ENV MAMBA_USER=$MAMBA_USER +ENV MAMBA_ROOT_PREFIX="/opt/conda" +ENV MAMBA_EXE="/bin/micromamba" + +USER $MAMBA_USER + +RUN apt-get update --yes && apt-get install --yes --no-install-recommends \ + apt-transport-https \ + pciutils \ + cups-filters \ + cups-common \ + cups-pdf \ + ca-certificates \ + git \ + wget \ + sudo \ + libatomic1 \ + python3.12 \ + python3-cups \ + python3-xdg \ + python3-pyinotify \ + python3-paramiko \ + python3-netifaces \ + python-is-python3 \ + gnome-menus \ + curl \ + locales \ + openjdk-17-jre \ + gnupg \ + kmod \ + x11-xkb-utils \ + dbus-x11 \ + xvfb \ + terminator \ + thunar && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +COPY --from=micromamba "$MAMBA_EXE" "$MAMBA_EXE" +COPY --from=micromamba /usr/local/bin/_activate_current_env.sh /usr/local/bin/_activate_current_env.sh +COPY --from=micromamba /usr/local/bin/_dockerfile_shell.sh /usr/local/bin/_dockerfile_shell.sh +COPY --from=micromamba /usr/local/bin/_dockerfile_initialize_user_accounts.sh /usr/local/bin/_dockerfile_initialize_user_accounts.sh +COPY --from=micromamba /usr/local/bin/_dockerfile_setup_root_prefix.sh /usr/local/bin/_dockerfile_setup_root_prefix.sh + +RUN /usr/local/bin/_dockerfile_initialize_user_accounts.sh && \ + /usr/local/bin/_dockerfile_setup_root_prefix.sh +SHELL ["/usr/local/bin/_dockerfile_shell.sh"] + + +# Install Xpra +RUN wget -O "/usr/share/keyrings/xpra.asc" https://xpra.org/xpra.asc && \ + wget -O "/etc/apt/sources.list.d/xpra.sources" https://raw.githubusercontent.com/Xpra-org/xpra/master/packaging/repos/noble/xpra.sources + +ARG xpra_version=6.2.0-r2-1 +RUN apt-get update --yes && apt-get install --yes --no-install-recommends \ + xpra-html5 \ + xpra=${xpra_version} \ + xpra-client=${xpra_version} \ + xpra-client-gtk3=${xpra_version} \ + xpra-server=${xpra_version} \ + xpra-codecs=${xpra_version} \ + xpra-codecs-extras=${xpra_version} \ + xpra-common=${xpra_version} \ + xpra-x11=${xpra_version} && \ + apt-get clean && rm -rf /var/lib/apt/lists/* + +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + dpkg-reconfigure --frontend=noninteractive locales && \ + update-locale LANG=en_US.UTF-8 +ENV LANG=en_US.UTF-8 + +# Create a conda env with the most recent compatible IGV +RUN rm -rf /opt/conda/pkgs/*.lock && \ + micromamba create -y -n igv -c bioconda -c conda-forge \ + igv \ + && micromamba clean --all --yes \ + && rm -rf /opt/conda/pkgs/*.lock + +# Copy the menu item contents, add to the env, make it executable +COPY ./menu_items.txt /usr/share/applications/.desktop +RUN chmod +x /usr/share/applications/.desktop + +# Copy the welcome message into the container and append it to the .bashrc +COPY ./welcome_ASCII.txt /root/.welcome_ASCII.txt +RUN echo "cat /root/.welcome_ASCII.txt" >> /root/.bashrc +COPY ./entry.sh /bin + +COPY ./seqera-wallpaper.png /usr/share/xpra/www/background.png + +WORKDIR /workspace +RUN ln -s /workspace /root + +# Add connect binary +COPY --from=connect /usr/bin/connect-client /usr/bin/connect-client +# Install connect dependencies +RUN /usr/bin/connect-client --install + +ENTRYPOINT ["/usr/bin/connect-client", "--entrypoint"] +CMD ["bash", "/bin/entry.sh"] diff --git a/xpra-igv/README.md b/xpra-igv/README.md new file mode 100644 index 0000000..541a3e2 --- /dev/null +++ b/xpra-igv/README.md @@ -0,0 +1,75 @@ +# Xpra and Integrative Genomics Viewer (IGV) Studio Environment + +This repository provides a custom container image for running +[Xpra](https://xpra.org/index.html) and the [IGV](https://igv.org/) +desktop Java application as a Studio environment in Seqera Platform. + +## Table of Contents + +- [Overview](#overview) +- [Features](#features) +- [Prerequisites](#prerequisites) +- [Building the Container](#building-the-container) +- [Using in Seqera Studios](#using-in-seqera-studios) +- [Customizing the Environment](#customizing-the-environment) +- [References](#references) + +## Overview + +This container is designed for use as a [custom Studio +environment](https://docs.seqera.io/platform-cloud/studios/custom-envs) in +Seqera Platform. It is based on the required Seqera base image and +includes the necessary `connect-client` for compatibility. + +## Features + +- Open-source, remote desktop display server +- IGV desktop Java application (v2.19.4) +- Reproducible and git-friendly +- Compatible with Seqera Studios custom environments + +## Prerequisites + +- [Docker](https://www.docker.com/) installed +- [Wave](https://docs.seqera.io/platform-cloud/wave/) configured +in your Seqera Platform workspace (required for custom environments) +- Access to a container registry (public or Amazon ECR) if you wish to push your image + +## Building the Container + +To build the container locally: + +```sh +wave -f Dockerfile --await +``` + +Or, using Docker directly: + +```sh +docker build -t xpra-igv . +``` + +## Using in Seqera Studios + +1. **Push your image** to a container registry accessible by Seqera Platform. +2. In Seqera Platform, go to the **Studios** tab and click **Add Studio**. +3. Select **Prebuilt container image** as the template. +4. Enter your container image URI (e.g., `cr.your-registry.io/your-org/marimo-studio:latest`). +5. Configure compute resources and data mounts as needed. +6. Launch the Studio. + +For more details, see the [official documentation](https://docs.seqera.io/platform-cloud/studios/custom-envs). + +## Customizing the Environment + +You can further customize this environment by: + +- Adding Conda or pip packages (see [Conda package syntax](https://docs.seqera.io/platform-cloud/studios/custom-envs#conda-package-syntax)) +- Modifying the Dockerfile to include additional dependencies + +## References + +- [Seqera Studios: Custom Environments](https://docs.seqera.io/platform-cloud/studios/custom-envs) +- [Xpra Documentation](https://github.com/Xpra-org/xpra/blob/master/README.md) +- [IGV Desktop Documentation](https://github.com/igvteam/igv) +- [Wave Documentation](https://docs.seqera.io/platform-cloud/wave/) diff --git a/xpra-igv/entry.sh b/xpra-igv/entry.sh new file mode 100644 index 0000000..aee199e --- /dev/null +++ b/xpra-igv/entry.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +source /usr/local/bin/_activate_current_env.sh +# automatically initialize all future (bash) shells, so that micromambe environments can be activated and deactivated +micromamba shell init --shell bash --root-prefix=~/micromamba + +# Default video encoder +video_encoder="x264" + +# Check for NVIDIA or AMD GPU presence +if lspci | grep -E "VGA|3D|NVIDIA|AMD"; then + # Assuming the presence of NVIDIA drivers and utilities + if command -v nvidia-smi &> /dev/null; then + video_encoder="nvenc" + elif glxinfo | grep -i "direct rendering: Yes"; then + # Check for AMD or other GPU types that support VA-API (Intel included) + video_encoder="vaapi" + fi +fi + +exec xpra start \ +--bind-tcp=0.0.0.0:$CONNECT_TOOL_PORT \ +--mdns=no \ +--html=on \ +--pulseaudio=no \ +--clipboard-direction=both \ +--clipboard=yes \ +--dpi=300 \ +--encoding=auto \ +--video-encoder=$video_encoder \ +--min-quality=95 \ +--min-speed=95 \ +--desktop-scaling=auto \ +--windows=yes \ +--daemon=no \ +--start-child="terminator" \ +--start-child="igv" \ +--idle-timeout=21600 \ +--mousewheel=on \ +--opengl=yes \ +--tray=yes \ +--system-tray=yes \ +--sharing=yes \ +--ssl=www \ +--exit-with-client=no \ +--file-transfer=on \ +--open-files=no \ +--webcam=no \ +--notifications=no \ +--bell=no :100 diff --git a/xpra-igv/menu_items.txt b/xpra-igv/menu_items.txt new file mode 100644 index 0000000..1fb57e8 --- /dev/null +++ b/xpra-igv/menu_items.txt @@ -0,0 +1,9 @@ +[Desktop Entry] +Version=1.0 +Type=Application +Name=IGV +Comment=Integrative Genomics Viewer +Exec=/opt/conda/bin/igv +Icon=utilities-terminal +Terminal=false +Categories=System;Science;Biology; diff --git a/xpra-igv/seqera-wallpaper.png b/xpra-igv/seqera-wallpaper.png new file mode 100644 index 0000000..5a7ba44 Binary files /dev/null and b/xpra-igv/seqera-wallpaper.png differ diff --git a/xpra-igv/welcome_ASCII.txt b/xpra-igv/welcome_ASCII.txt new file mode 100644 index 0000000..c2d37a3 --- /dev/null +++ b/xpra-igv/welcome_ASCII.txt @@ -0,0 +1,15 @@ +.--------------------------------------------------------------------------. +| | +| ____ ____ _ _ _ | +| / ___| ___ __ _ ___ _ __ __ _ / ___|| |_ _ _ __| (_) ___ ___ | +| \___ \ / _ \/ _` |/ _ \ '__/ _` | \___ \| __| | | |/ _` | |/ _ \/ __| | +| ___) | __/ (_| | __/ | | (_| | ___) | |_| |_| | (_| | | (_) \__ \ | +| |____/ \___|\__, |\___|_| \__,_| |____/ \__|\__,_|\__,_|_|\___/|___/ | +| __ __ |_| ___ ______ __ | +| \ \/ /_ __ _ __ __ _ _ |_ _/ ___\ \ / / | +| \ /| '_ \| '__/ _` | _| |_ | | | _ \ \ / / | +| / \| |_) | | | (_| | |_ _| | | |_| | \ V / | +| /_/\_\ .__/|_| \__,_| |_| |___\____| \_/ | +| |_| | +| | +'--------------------------------------------------------------------------'