Skip to content

Commit

Permalink
Add extra packages in layer 1
Browse files Browse the repository at this point in the history
  • Loading branch information
robballantyne committed Jan 24, 2024
1 parent 8365227 commit 286ed81
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 42 deletions.
38 changes: 2 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Run a hardware accelerated KDE desktop in a container. This image is heavily inf

You may connect to the container through the [Selkies-gstreamer](https://github.com/selkies-project/selkies-gstreamer) WebRTC interface (default port `6100`) or through the [KasmVNC](https://github.com/kasmtech/KasmVNC) client (default port `6200`)

A [turn server](https://github.com/coturn/coturn) is bundled with the image to ensure connectivity is possible in most circumstances. You should always prefer the WebRTC interface and use the VNC client only if all else fails.
A [turn server](https://github.com/coturn/coturn) is bundled with the image to ensure connectivity is possible in most circumstances. You should always prefer the WebRTC interface and use the VNC client only if you are unable to establish a WebRTC connection.

When running with an NVIDIA GPU, the container will attempt to download the relevant graphics driver and start a GLX enabled Xorg session. For all other systems an Xvfb instance will be launched for VirtualGL rendering.

Expand All @@ -28,7 +28,7 @@ An incremental build process is used to avoid needing a huge cache - The followi

- [nvidia/cuda](https://github.com/NVIDIA/nvidia-docker) / [ubuntu](https://github.com/docker-library/docs/tree/master/ubuntu) ↴
- [ai-dock/base-image](https://github.com/ai-dock/base-image) ↴
- ai-dock/desktop
- ai-dock/linux-desktop

#### Version Tags

Expand Down Expand Up @@ -189,43 +189,9 @@ The URL must point to a plain text file - GitHub Gists/Pastebin (raw) are suitab

If you are running locally you may instead opt to mount a script at `/opt/ai-dock/bin/provisioning.sh`.

>[!NOTE]
>If configured, `sshd`, `caddy`, `cloudflared`, `rclone`, `serviceportal`, `storagemonitor` & `logtail` will be launched before provisioning; Any other processes will launch after.
>[!WARNING]
>Only use scripts that you trust and which cannot be changed without your consent.
## Software Management

A small software collection is installed by apt-get to provide basic utility.

All other software is installed into its own environment by `micromamba`, which is a drop-in replacement for conda/mamba. Read more about it [here](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html).

Micromamba environments are particularly useful where several software packages are required but their dependencies conflict.

### Installed Micromamba Environments

| Environment | Packages |
| -------------- | ----------------------------------------- |
| `base` | micromamba's base environment |

If you are extending this image or running an interactive session where additional software is required, you should almost certainly create a new environment first. See below for guidance.

### Useful Micromamba Commands

| Command | Function |
| -------------------------------------| --------------------- |
| `micromamba env list` | List available environments |
| `micromamba activate [name]` | Activate the named environment |
| `micromamba deactivate` | Close the active environment |
| `micromamba run -n [name] [command]` | Run a command in the named environment without activating |

All ai-dock images create micromamba environments using the `--always-softlink` flag which can save disk space where multiple environments are available.

To create an additional micromamba environment, eg for python, you can use the following:

`micromamba --always-softlink create -y -c conda-forge -n [name] python=3.10`

## Volumes

Data inside docker containers is ephemeral - You'll lose all of it when the container is destroyed.
Expand Down
1 change: 1 addition & 0 deletions build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
source /opt/ai-dock/etc/environment.sh

build_common_main() {
add-apt-repository multiverse
apt-get update
build_common_install_xorg
build_common_install_virtualgl
Expand Down
7 changes: 7 additions & 0 deletions build/COPY_ROOT/opt/ai-dock/bin/preflight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ function preflight_main() {
export COTURN_PASSWORD="auto_$(openssl rand -base64 8)"
env-store COTURN_PASSWORD
fi

desktop_dir="${WORKSPACE}/home/${USER_NAME}/Desktop"
mkdir -p ${desktop_dir}
chown ${USER_NAME}.${USER_NAME} "${desktop_dir}"
ln -sf "${WORKSPACE}" "${desktop_dir}"

locale-gen $LANG
}

preflight_main "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ function start() {
export TURN_PASSWORD="${COTURN_PASSWORD:-password}"
fi

export LD_PRELOAD /usr/local/lib/selkies-js-interposer/joystick_interposer.so${LD_PRELOAD:+:${LD_PRELOAD}}

selkies-gstreamer \
--enable_basic_auth=false \
--addr="127.0.0.1" \
Expand Down
40 changes: 39 additions & 1 deletion build/COPY_ROOT_EXTRA/opt/ai-dock/bin/build/layer1/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,43 @@

# Override this file to add extras to your build

# Wine, Winetricks, Lutris, and PlayOnLinux, this process must be consistent with https://wiki.winehq.org/Ubuntu

mkdir -pm755 /etc/apt/keyrings
curl -fsSL -o /etc/apt/keyrings/winehq-archive.key "https://dl.winehq.org/wine-builds/winehq.key"
curl -fsSL -o "/etc/apt/sources.list.d/winehq-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').sources" "https://dl.winehq.org/wine-builds/ubuntu/dists/$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"')/winehq-$(grep UBUNTU_CODENAME= /etc/os-release | cut -d= -f2 | tr -d '\"').sources"
apt-get update
apt-get install --install-recommends -y \
winehq-${WINE_BRANCH}
apt-get install --no-install-recommends -y \
q4wine \
playonlinux
LUTRIS_VERSION="$(curl -fsSL "https://api.github.com/repos/lutris/lutris/releases/latest" | jq -r '.tag_name' | sed 's/[^0-9\.\-]*//g')"
curl -fsSL -O "https://github.com/lutris/lutris/releases/download/v${LUTRIS_VERSION}/lutris_${LUTRIS_VERSION}_all.deb"
apt-get install --no-install-recommends -y ./lutris_${LUTRIS_VERSION}_all.deb && rm -f "./lutris_${LUTRIS_VERSION}_all.deb"
curl -fsSL -o /usr/bin/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks"
chmod 755 /usr/bin/winetricks
curl -fsSL -o /usr/share/bash-completion/completions/winetricks "https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.bash-completion"
ln -sf /usr/games/lutris /usr/bin/lutris
# Libre Office

apt-get install --install-recommends -y \
libreoffice \
libreoffice-kf5 \
libreoffice-plasma \
libreoffice-style-breeze

# Steam

$APT_INSTALL \
steam-installer
ln -sf /usr/games/steam /usr/bin/steam

# Graphics utils

$APT_INSTALL \
blender \
blender-data \
gimp \
inkscape


11 changes: 9 additions & 2 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ LABEL org.opencontainers.image.source https://github.com/ai-dock/linux-desktop
LABEL org.opencontainers.image.description "Docker desktop environment"
LABEL maintainer="Rob Ballantyne <rob@dynamedia.uk>"

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

ENV USER_GROUPS=${USER_GROUPS},input,lpadmin,pulse-access
ENV DISPLAY :0
ENV VNC_DISPLAY :1
Expand Down Expand Up @@ -53,6 +57,11 @@ ENV QT_IM_MODULE fcitx
ENV XIM fcitx
ENV XMODIFIERS "@im=fcitx"

ENV APPIMAGE_EXTRACT_AND_RUN 1

ARG WINE_BRANCH=staging
ENV WINE_BRANCH=${WINE_BRANCH}

# Copy early so we can use scripts in the build - Changes to these files will invalidate the cache and cause a rebuild.
COPY ./COPY_ROOT/ /

Expand All @@ -68,7 +77,5 @@ RUN set -eo pipefail && /opt/ai-dock/bin/build/layer0/init.sh | tee /var/log/bui
COPY ./COPY_ROOT_EXTRA/ /
RUN set -eo pipefail && /opt/ai-dock/bin/build/layer1/init.sh | tee -a /var/log/build.log

ENV LD_PRELOAD /usr/local/lib/selkies-js-interposer/joystick_interposer.so${LD_PRELOAD:+:${LD_PRELOAD}}

# Keep init.sh as-is and place additional logic in /opt/ai-dock/bin/preflight.sh
CMD ["init.sh"]
8 changes: 5 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ services:
build:
context: ./build
args:
IMAGE_BASE: ${IMAGE_BASE:-ghcr.io/ai-dock/base-image:cuda-11.8.0-base-22.04}
IMAGE_BASE: ${IMAGE_BASE:-ghcr.io/ai-dock/base-image:cuda-11.8.0-runtime-22.04}
tags:
- "ghcr.io/ai-dock/desktop:${IMAGE_TAG:-cuda-11.8.0-base-22.04}"
- "ghcr.io/ai-dock/desktop:${IMAGE_TAG:-cuda-11.8.0-runtime-22.04}"

image: ghcr.io/ai-dock/desktop:${IMAGE_TAG:-cuda-11.8.0-base-22.04}
image: ghcr.io/ai-dock/linux-desktop:${IMAGE_TAG:-cuda-11.8.0-base-22.04}

shm_size: 2G

## For Nvidia GPU's - You probably want to uncomment this
#deploy:
Expand Down

0 comments on commit 286ed81

Please sign in to comment.