Update base image to Ubuntu 24.04

This commit is contained in:
Héctor Molinero Fernández
2024-05-28 19:36:22 +02:00
parent e732499b5b
commit 649bc33cb7
12 changed files with 239 additions and 151 deletions

View File

@@ -4,16 +4,21 @@ m4_changequote([[, ]])
## "build" stage ## "build" stage
################################################## ##################################################
m4_ifdef([[CROSS_ARCH]], [[FROM docker.io/CROSS_ARCH/ubuntu:22.04]], [[FROM docker.io/ubuntu:22.04]]) AS build m4_ifdef([[CROSS_ARCH]], [[FROM docker.io/CROSS_ARCH/ubuntu:24.04]], [[FROM docker.io/ubuntu:24.04]]) AS build
m4_ifdef([[CROSS_QEMU]], [[COPY --from=docker.io/hectorm/qemu-user-static:latest CROSS_QEMU CROSS_QEMU]]) m4_ifdef([[CROSS_QEMU]], [[COPY --from=docker.io/hectorm/qemu-user-static:latest CROSS_QEMU CROSS_QEMU]])
SHELL ["/bin/sh", "-euc"]
# Enable source repositories # Enable source repositories
RUN sed -i 's/^#\s*\(deb-src\s\)/\1/g' /etc/apt/sources.list RUN <<-EOF
sed -i '/^Types: deb$/s/$/ deb-src/' /etc/apt/sources.list.d/ubuntu.sources
EOF
# Install packages # Install packages
RUN export DEBIAN_FRONTEND=noninteractive \ RUN <<-EOF
&& apt-get update \ export DEBIAN_FRONTEND=noninteractive
&& apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \ apt-get update
apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \
autoconf \ autoconf \
automake \ automake \
bison \ bison \
@@ -70,42 +75,43 @@ RUN export DEBIAN_FRONTEND=noninteractive \
xserver-xorg-dev \ xserver-xorg-dev \
xsltproc \ xsltproc \
xutils-dev \ xutils-dev \
zlib1g-dev \ zlib1g-dev
&& apt-get clean apt-get clean
EOF
# Build libjpeg-turbo # Build libjpeg-turbo
ARG LIBJPEG_TURBO_TREEISH=3.0.3 ARG LIBJPEG_TURBO_TREEISH=3.0.3
ARG LIBJPEG_TURBO_REMOTE=https://github.com/libjpeg-turbo/libjpeg-turbo.git ARG LIBJPEG_TURBO_REMOTE=https://github.com/libjpeg-turbo/libjpeg-turbo.git
RUN mkdir /tmp/libjpeg-turbo/
WORKDIR /tmp/libjpeg-turbo/ WORKDIR /tmp/libjpeg-turbo/
RUN git clone "${LIBJPEG_TURBO_REMOTE:?}" ./ RUN <<-EOF
RUN git checkout "${LIBJPEG_TURBO_TREEISH:?}" git clone "${LIBJPEG_TURBO_REMOTE:?}" ./
RUN git submodule update --init --recursive git checkout "${LIBJPEG_TURBO_TREEISH:?}"
RUN mkdir /tmp/libjpeg-turbo/build/ git submodule update --init --recursive
EOF
WORKDIR /tmp/libjpeg-turbo/build/ WORKDIR /tmp/libjpeg-turbo/build/
RUN cmake ./ \ RUN <<-EOF
cmake ./ \
-G 'Unix Makefiles' \ -G 'Unix Makefiles' \
-D PKGNAME=libjpeg-turbo \ -D PKGNAME=libjpeg-turbo \
-D CMAKE_BUILD_TYPE=Release \ -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/opt/libjpeg-turbo \ -D CMAKE_INSTALL_PREFIX=/opt/libjpeg-turbo \
-D CMAKE_POSITION_INDEPENDENT_CODE=1 \ -D CMAKE_POSITION_INDEPENDENT_CODE=1 \
../ ../
RUN make -j"$(nproc)" make -j"$(nproc)" install
RUN make deb EOF
RUN dpkg -i ./libjpeg-turbo_*.deb
# Build VirtualGL # Build VirtualGL
ARG VIRTUALGL_TREEISH=3.1.1 ARG VIRTUALGL_TREEISH=3.1.1
ARG VIRTUALGL_REMOTE=https://github.com/VirtualGL/virtualgl.git ARG VIRTUALGL_REMOTE=https://github.com/VirtualGL/virtualgl.git
RUN mkdir /tmp/virtualgl/
WORKDIR /tmp/virtualgl/ WORKDIR /tmp/virtualgl/
RUN git clone "${VIRTUALGL_REMOTE:?}" ./ RUN <<-EOF
RUN git checkout "${VIRTUALGL_TREEISH:?}" git clone "${VIRTUALGL_REMOTE:?}" ./
RUN git submodule update --init --recursive git checkout "${VIRTUALGL_TREEISH:?}"
RUN mkdir /tmp/virtualgl/build/ git submodule update --init --recursive
EOF
WORKDIR /tmp/virtualgl/build/ WORKDIR /tmp/virtualgl/build/
RUN sed -i "s|@DEBARCH@|$(dpkg-architecture -qDEB_HOST_ARCH)|g" ../release/deb-control.in RUN <<-EOF
RUN cmake ./ \ cmake ./ \
-G 'Unix Makefiles' \ -G 'Unix Makefiles' \
-D PKGNAME=virtualgl \ -D PKGNAME=virtualgl \
-D CMAKE_BUILD_TYPE=Release \ -D CMAKE_BUILD_TYPE=Release \
@@ -113,21 +119,21 @@ RUN cmake ./ \
-D CMAKE_POSITION_INDEPENDENT_CODE=1 \ -D CMAKE_POSITION_INDEPENDENT_CODE=1 \
-D VGL_EGLBACKEND=1 \ -D VGL_EGLBACKEND=1 \
../ ../
RUN make -j"$(nproc)" make -j"$(nproc)" install
RUN make deb EOF
RUN dpkg -i ./virtualgl_*.deb
# Build TurboVNC # Build TurboVNC
ARG TURBOVNC_TREEISH=3.1.1 ARG TURBOVNC_TREEISH=3.1.1
ARG TURBOVNC_REMOTE=https://github.com/TurboVNC/turbovnc.git ARG TURBOVNC_REMOTE=https://github.com/TurboVNC/turbovnc.git
RUN mkdir /tmp/turbovnc/
WORKDIR /tmp/turbovnc/ WORKDIR /tmp/turbovnc/
RUN git clone "${TURBOVNC_REMOTE:?}" ./ RUN <<-EOF
RUN git checkout "${TURBOVNC_TREEISH:?}" git clone "${TURBOVNC_REMOTE:?}" ./
RUN git submodule update --init --recursive git checkout "${TURBOVNC_TREEISH:?}"
RUN mkdir /tmp/turbovnc/build/ git submodule update --init --recursive
EOF
WORKDIR /tmp/turbovnc/build/ WORKDIR /tmp/turbovnc/build/
RUN cmake ./ \ RUN <<-EOF
cmake ./ \
-G 'Unix Makefiles' \ -G 'Unix Makefiles' \
-D PKGNAME=turbovnc \ -D PKGNAME=turbovnc \
-D CMAKE_BUILD_TYPE=Release \ -D CMAKE_BUILD_TYPE=Release \
@@ -143,21 +149,23 @@ RUN cmake ./ \
-D TVNC_GLX=1 \ -D TVNC_GLX=1 \
-D TVNC_NVCONTROL=1 \ -D TVNC_NVCONTROL=1 \
../ ../
RUN make -j"$(nproc)" make -j"$(nproc)" install
RUN make deb EOF
RUN dpkg -i ./turbovnc_*.deb
# Build xrdp # Build xrdp
ARG XRDP_TREEISH=v0.10.0 ARG XRDP_TREEISH=v0.10.0
ARG XRDP_REMOTE=https://github.com/neutrinolabs/xrdp.git ARG XRDP_REMOTE=https://github.com/neutrinolabs/xrdp.git
RUN mkdir /tmp/xrdp/
WORKDIR /tmp/xrdp/ WORKDIR /tmp/xrdp/
RUN git clone "${XRDP_REMOTE:?}" ./ RUN <<-EOF
RUN git checkout "${XRDP_TREEISH:?}" git clone "${XRDP_REMOTE:?}" ./
RUN git submodule update --init --recursive git checkout "${XRDP_TREEISH:?}"
RUN ./bootstrap git submodule update --init --recursive
RUN ./configure \ EOF
--prefix=/usr \ RUN <<-EOF
./bootstrap
./configure \
--prefix=/opt/xrdp \
--enable-strict-locations \
--enable-vsock \ --enable-vsock \
--enable-tjpeg \ --enable-tjpeg \
--enable-fuse \ --enable-fuse \
@@ -166,56 +174,75 @@ RUN ./configure \
--enable-mp3lame \ --enable-mp3lame \
--enable-pixman \ --enable-pixman \
--enable-ipv6 --enable-ipv6
RUN make -j"$(nproc)" make -j"$(nproc)" install
RUN checkinstall --default --pkgname=xrdp --pkgversion=9:999 --pkgrelease=0 rm -f /opt/xrdp/etc/xrdp/rsakeys.ini /opt/xrdp/etc/xrdp/*.pem
EOF
# Build xorgxrdp # Build xorgxrdp
ARG XORGXRDP_TREEISH=v0.10.1 ARG XORGXRDP_TREEISH=v0.10.1
ARG XORGXRDP_REMOTE=https://github.com/neutrinolabs/xorgxrdp.git ARG XORGXRDP_REMOTE=https://github.com/neutrinolabs/xorgxrdp.git
RUN mkdir /tmp/xorgxrdp/
WORKDIR /tmp/xorgxrdp/ WORKDIR /tmp/xorgxrdp/
RUN git clone "${XORGXRDP_REMOTE:?}" ./ RUN <<-EOF
RUN git checkout "${XORGXRDP_TREEISH:?}" git clone "${XORGXRDP_REMOTE:?}" ./
RUN git submodule update --init --recursive git checkout "${XORGXRDP_TREEISH:?}"
RUN ./bootstrap git submodule update --init --recursive
RUN ./configure --enable-glamor EOF
RUN make -j"$(nproc)" RUN <<-EOF
RUN checkinstall --default --pkgname=xorgxrdp --pkgversion=9:999 --pkgrelease=0 ./bootstrap
./configure \
--prefix=/opt/xrdp \
--enable-strict-locations \
--enable-glamor \
PKG_CONFIG_PATH=/opt/xrdp/lib/pkgconfig
make -j"$(nproc)" install
EOF
# Build xrdp PulseAudio module # Build xrdp PulseAudio module
ARG XRDP_PULSEAUDIO_TREEISH=v0.7 ARG XRDP_PULSEAUDIO_TREEISH=v0.7
ARG XRDP_PULSEAUDIO_REMOTE=https://github.com/neutrinolabs/pulseaudio-module-xrdp.git ARG XRDP_PULSEAUDIO_REMOTE=https://github.com/neutrinolabs/pulseaudio-module-xrdp.git
WORKDIR /tmp/ WORKDIR /tmp/
RUN DEBIAN_FRONTEND=noninteractive apt-get build-dep -y pulseaudio RUN <<-EOF
RUN apt-get source pulseaudio && mv ./pulseaudio-*/ ./pulseaudio/ DEBIAN_FRONTEND=noninteractive apt-get build-dep -y pulseaudio
WORKDIR /tmp/pulseaudio/ apt-get source pulseaudio && mv ./pulseaudio-*/ ./pulseaudio/
RUN meson ./build/ meson setup ./pulseaudio/build/ ./pulseaudio/
RUN mkdir /tmp/xrdp-pulseaudio/ EOF
WORKDIR /tmp/xrdp-pulseaudio/ WORKDIR /tmp/pulseaudio-module-xrdp/
RUN git clone "${XRDP_PULSEAUDIO_REMOTE:?}" ./ RUN <<-EOF
RUN git checkout "${XRDP_PULSEAUDIO_TREEISH:?}" git clone "${XRDP_PULSEAUDIO_REMOTE:?}" ./
RUN git submodule update --init --recursive git checkout "${XRDP_PULSEAUDIO_TREEISH:?}"
RUN ./bootstrap git submodule update --init --recursive
RUN ./configure PULSE_DIR=/tmp/pulseaudio/ EOF
RUN make -j"$(nproc)" RUN <<-EOF
RUN checkinstall --default --pkgname=xrdp-pulseaudio --pkgversion=9:999 --pkgrelease=0 ./bootstrap
./configure \
--prefix=/opt/xrdp \
--with-module-dir=/opt/xrdp/lib/pulse/modules \
PKG_CONFIG_PATH=/opt/xrdp/lib/pkgconfig \
PULSE_DIR=/tmp/pulseaudio/
make -j"$(nproc)" install
EOF
################################################## ##################################################
## "main" stage ## "main" stage
################################################## ##################################################
m4_ifdef([[CROSS_ARCH]], [[FROM docker.io/CROSS_ARCH/ubuntu:22.04]], [[FROM docker.io/ubuntu:22.04]]) AS main m4_ifdef([[CROSS_ARCH]], [[FROM docker.io/CROSS_ARCH/ubuntu:24.04]], [[FROM docker.io/ubuntu:24.04]]) AS main
m4_ifdef([[CROSS_QEMU]], [[COPY --from=docker.io/hectorm/qemu-user-static:latest CROSS_QEMU CROSS_QEMU]]) m4_ifdef([[CROSS_QEMU]], [[COPY --from=docker.io/hectorm/qemu-user-static:latest CROSS_QEMU CROSS_QEMU]])
SHELL ["/bin/sh", "-euc"]
# Copy APT config # Copy APT config
COPY --chown=root:root ./config/apt/preferences.d/ /etc/apt/preferences.d/ COPY --chown=root:root ./config/apt/preferences.d/ /etc/apt/preferences.d/
RUN find /etc/apt/preferences.d/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';' RUN <<-EOF
RUN find /etc/apt/preferences.d/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';' find /etc/apt/preferences.d/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';'
find /etc/apt/preferences.d/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';'
EOF
# Install base packages # Install base packages
RUN export DEBIAN_FRONTEND=noninteractive \ RUN <<-EOF
&& apt-get update \ export DEBIAN_FRONTEND=noninteractive
&& apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \ apt-get update
apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \
at-spi2-core \ at-spi2-core \
ca-certificates \ ca-certificates \
catatonit \ catatonit \
@@ -279,20 +306,20 @@ RUN export DEBIAN_FRONTEND=noninteractive \
xserver-xorg-video-dummy \ xserver-xorg-video-dummy \
xserver-xorg-video-fbdev \ xserver-xorg-video-fbdev \
xserver-xorg-video-vesa \ xserver-xorg-video-vesa \
zlib1g \ zlib1g
m4_ifelse(ENABLE_AMD_SUPPORT, 1, [[m4_dnl m4_ifelse(ENABLE_AMD_SUPPORT, 1, [[m4_dnl
&& apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \ apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \
libdrm-amdgpu1 \ libdrm-amdgpu1 \
xserver-xorg-video-amdgpu \ xserver-xorg-video-amdgpu
]])m4_dnl ]])m4_dnl
m4_ifelse(ENABLE_INTEL_SUPPORT, 1, [[m4_dnl m4_ifelse(ENABLE_INTEL_SUPPORT, 1, [[m4_dnl
&& apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \ apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \
intel-opencl-icd \ intel-opencl-icd \
libdrm-intel1 \ libdrm-intel1 \
xserver-xorg-video-intel \ xserver-xorg-video-intel
]])m4_dnl ]])m4_dnl
m4_ifelse(ENABLE_NVIDIA_SUPPORT, 1, [[m4_dnl m4_ifelse(ENABLE_NVIDIA_SUPPORT, 1, [[m4_dnl
&& apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \ apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \
libdrm-nouveau2 \ libdrm-nouveau2 \
libnvidia-cfg1-550 \ libnvidia-cfg1-550 \
libnvidia-compute-550 \ libnvidia-compute-550 \
@@ -302,18 +329,23 @@ m4_ifelse(ENABLE_NVIDIA_SUPPORT, 1, [[m4_dnl
libnvidia-fbc1-550 \ libnvidia-fbc1-550 \
libnvidia-gl-550 \ libnvidia-gl-550 \
xserver-xorg-video-nouveau \ xserver-xorg-video-nouveau \
xserver-xorg-video-nvidia-550 \ xserver-xorg-video-nvidia-550
]])m4_dnl ]])m4_dnl
&& rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
rm -f /etc/ssh/ssh_host_*_key
EOF
# Add Mozilla Team repository # Add Mozilla Team repository
RUN curl --proto '=https' --tlsv1.3 -sSf 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0AB215679C571D1C8325275B9BDB3D89CE49EC21' | gpg --dearmor -o /etc/apt/trusted.gpg.d/mozillateam.gpg \ RUN <<-EOF
&& printf '%s\n' "deb [signed-by=/etc/apt/trusted.gpg.d/mozillateam.gpg] https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/mozillateam.list curl --proto '=https' --tlsv1.3 -sSf 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0AB215679C571D1C8325275B9BDB3D89CE49EC21' | gpg --dearmor -o /etc/apt/trusted.gpg.d/mozillateam.gpg
printf '%s\n' "deb [signed-by=/etc/apt/trusted.gpg.d/mozillateam.gpg] https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/mozillateam.list
EOF
# Install extra packages # Install extra packages
RUN export DEBIAN_FRONTEND=noninteractive \ RUN <<-EOF
&& apt-get update \ export DEBIAN_FRONTEND=noninteractive
&& apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \ apt-get update
apt-get install -y --no-install-recommends -o APT::Immediate-Configure=0 \
adwaita-icon-theme-full \ adwaita-icon-theme-full \
adwaita-qt \ adwaita-qt \
audacity \ audacity \
@@ -387,7 +419,6 @@ RUN export DEBIAN_FRONTEND=noninteractive \
xfce4-panel-profiles \ xfce4-panel-profiles \
xfce4-pulseaudio-plugin \ xfce4-pulseaudio-plugin \
xfce4-screenshooter \ xfce4-screenshooter \
xfce4-statusnotifier-plugin \
xfce4-taskmanager \ xfce4-taskmanager \
xfce4-terminal \ xfce4-terminal \
xfce4-whiskermenu-plugin \ xfce4-whiskermenu-plugin \
@@ -398,29 +429,26 @@ RUN export DEBIAN_FRONTEND=noninteractive \
xutils \ xutils \
xz-utils \ xz-utils \
zenity \ zenity \
zip \ zip
&& rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
EOF
# Install libjpeg-turbo from package # Copy libjpeg-turbo build
RUN --mount=type=bind,from=build,source=/tmp/libjpeg-turbo/,target=/tmp/libjpeg-turbo/ dpkg -i /tmp/libjpeg-turbo/build/libjpeg-turbo_*.deb COPY --from=build /opt/libjpeg-turbo/ /opt/libjpeg-turbo/
# Install VirtualGL from package # Copy VirtualGL build
RUN --mount=type=bind,from=build,source=/tmp/virtualgl/,target=/tmp/virtualgl/ dpkg -i /tmp/virtualgl/build/virtualgl_*.deb COPY --from=build /opt/VirtualGL/ /opt/VirtualGL/
# Install TurboVNC from package # Copy TurboVNC build
RUN --mount=type=bind,from=build,source=/tmp/turbovnc/,target=/tmp/turbovnc/ dpkg -i /tmp/turbovnc/build/turbovnc_*.deb COPY --from=build /opt/TurboVNC/ /opt/TurboVNC/
# Install xrdp from package # Copy xrdp, xorgxrdp and PulseAudio module builds
RUN --mount=type=bind,from=build,source=/tmp/xrdp/,target=/tmp/xrdp/ dpkg -i /tmp/xrdp/xrdp_*.deb COPY --from=build /opt/xrdp/ /opt/xrdp/
# Install xorgxrdp from package
RUN --mount=type=bind,from=build,source=/tmp/xorgxrdp/,target=/tmp/xorgxrdp/ dpkg -i /tmp/xorgxrdp/xorgxrdp_*.deb
# Install xrdp PulseAudio module from package
RUN --mount=type=bind,from=build,source=/tmp/xrdp-pulseaudio/,target=/tmp/xrdp-pulseaudio/ dpkg -i /tmp/xrdp-pulseaudio/xrdp-pulseaudio_*.deb
# Environment # Environment
ENV SVDIR=/etc/service/ ENV SVDIR=/etc/service/
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
ENV PATH=/opt/libjpeg-turbo/bin:/opt/VirtualGL/bin:/opt/TurboVNC/bin:/opt/xrdp/sbin:/opt/xrdp/bin:${PATH}
ENV UNPRIVILEGED_USER_UID=1000 ENV UNPRIVILEGED_USER_UID=1000
ENV UNPRIVILEGED_USER_GID=1000 ENV UNPRIVILEGED_USER_GID=1000
ENV UNPRIVILEGED_USER_NAME=user ENV UNPRIVILEGED_USER_NAME=user
@@ -430,83 +458,109 @@ ENV UNPRIVILEGED_USER_SHELL=/bin/bash
ENV UNPRIVILEGED_USER_HOME=/home/user ENV UNPRIVILEGED_USER_HOME=/home/user
ENV SERVICE_XRDP_BOOTSTRAP_ENABLED=false ENV SERVICE_XRDP_BOOTSTRAP_ENABLED=false
ENV SERVICE_XORG_HEADLESS_ENABLED=false ENV SERVICE_XORG_HEADLESS_ENABLED=false
ENV XRDP_RSAKEYS_PATH=/etc/xrdp/rsakeys.ini
ENV XRDP_TLS_KEY_PATH=/etc/xrdp/key.pem ENV XRDP_TLS_KEY_PATH=/etc/xrdp/key.pem
ENV XRDP_TLS_CRT_PATH=/etc/xrdp/cert.pem ENV XRDP_TLS_CRT_PATH=/etc/xrdp/cert.pem
ENV STARTUP=xfce4-session ENV STARTUP=xfce4-session
ENV DESKTOP_SESSION=xubuntu ENV DESKTOP_SESSION=xubuntu
## Use Adwaita theme in QT applications
ENV QT_STYLE_OVERRIDE=Adwaita ENV QT_STYLE_OVERRIDE=Adwaita
# Setup locale # Setup locale
ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 ENV LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
RUN printf '%s\n' "${LANG:?} UTF-8" > /etc/locale.gen \ RUN <<-EOF
&& localedef -c -i "${LANG%%.*}" -f UTF-8 "${LANG:?}" ||: printf '%s\n' "${LANG:?} UTF-8" > /etc/locale.gen
localedef -c -i "${LANG%%.*}" -f UTF-8 "${LANG:?}" ||:
EOF
# Setup timezone # Setup timezone
ENV TZ=UTC ENV TZ=UTC
RUN printf '%s\n' "${TZ:?}" > /etc/timezone \ RUN <<-EOF
&& ln -snf "/usr/share/zoneinfo/${TZ:?}" /etc/localtime printf '%s\n' "${TZ:?}" > /etc/timezone
ln -snf "/usr/share/zoneinfo/${TZ:?}" /etc/localtime
# Setup PATH EOF
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
ENV PATH=/opt/libjpeg-turbo/bin:/opt/VirtualGL/bin:/opt/TurboVNC/bin:${PATH}
# Setup D-Bus # Setup D-Bus
RUN mkdir /run/dbus/ && chown messagebus:messagebus /run/dbus/ RUN <<-EOF
RUN dbus-uuidgen > /etc/machine-id dbus-uuidgen > /etc/machine-id
RUN ln -sf /etc/machine-id /var/lib/dbus/machine-id ln -sf /etc/machine-id /var/lib/dbus/machine-id
EOF
# Make sesman read environment variables # Make sesman read environment variables
RUN printf '%s\n' 'session required pam_env.so readenv=1' >> /etc/pam.d/xrdp-sesman RUN <<-EOF
printf '%s\n' 'session required pam_env.so readenv=1' >> /etc/pam.d/xrdp-sesman
EOF
# Remove default keys and certificates # Remove default user and group
RUN rm -f /etc/ssh/ssh_host_* RUN <<-EOF
RUN rm -f "${XRDP_TLS_KEY_PATH:?}" "${XRDP_TLS_CRT_PATH:?}" if id -u "${UNPRIVILEGED_USER_UID:?}" >/dev/null 2>&1; then userdel -f "$(id -nu "${UNPRIVILEGED_USER_UID:?}")"; fi
if id -g "${UNPRIVILEGED_USER_GID:?}" >/dev/null 2>&1; then groupdel "$(id -nu "${UNPRIVILEGED_USER_GID:?}")"; fi
EOF
# Create symlinks for xrdp RSA keys and TLS certificates
RUN <<-EOF
ln -svf "${XRDP_RSAKEYS_PATH:?}" /opt/xrdp/etc/xrdp/rsakeys.ini
ln -svf "${XRDP_TLS_KEY_PATH:?}" /opt/xrdp/etc/xrdp/key.pem
ln -svf "${XRDP_TLS_CRT_PATH:?}" /opt/xrdp/etc/xrdp/cert.pem
EOF
# Forward logs to Docker log collector # Forward logs to Docker log collector
RUN ln -sf /dev/stdout /var/log/xorg-headless.log RUN <<-EOF
RUN ln -sf /dev/stdout /var/log/xrdp.log ln -svf /dev/stdout /var/log/xorg-headless.log
RUN ln -sf /dev/stdout /var/log/xrdp-sesman.log ln -svf /dev/stdout /var/log/xrdp.log
ln -svf /dev/stdout /var/log/xrdp-sesman.log
EOF
# Copy and enable services # Copy and enable services
COPY --chown=root:root ./scripts/service/ /etc/sv/ COPY --chown=root:root ./scripts/service/ /etc/sv/
RUN find /etc/sv/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';' RUN <<-EOF
RUN find /etc/sv/ -type f -not -perm 0755 -exec chmod 0755 '{}' ';' find /etc/sv/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';'
RUN ln -sv /etc/sv/dbus-daemon "${SVDIR:?}" find /etc/sv/ -type f -not -perm 0755 -exec chmod 0755 '{}' ';'
RUN ln -sv /etc/sv/sshd "${SVDIR:?}" ln -sv /etc/sv/dbus-daemon "${SVDIR:?}"
RUN ln -sv /etc/sv/udevadm-trigger "${SVDIR:?}" ln -sv /etc/sv/sshd "${SVDIR:?}"
RUN ln -sv /etc/sv/udevd "${SVDIR:?}" ln -sv /etc/sv/udevadm-trigger "${SVDIR:?}"
RUN ln -sv /etc/sv/xrdp "${SVDIR:?}" ln -sv /etc/sv/udevd "${SVDIR:?}"
RUN ln -sv /etc/sv/xrdp-sesman "${SVDIR:?}" ln -sv /etc/sv/xrdp "${SVDIR:?}"
ln -sv /etc/sv/xrdp-sesman "${SVDIR:?}"
EOF
# Copy SSH config # Copy SSH config
COPY --chown=root:root ./config/ssh/ /etc/ssh/ COPY --chown=root:root ./config/ssh/ /etc/ssh/
RUN find /etc/ssh/sshd_config -type f -not -perm 0644 -exec chmod 0644 '{}' ';' RUN <<-EOF
find /etc/ssh/sshd_config -type f -not -perm 0644 -exec chmod 0644 '{}' ';'
EOF
# Copy X11 config # Copy X11 config
COPY --chown=root:root ./config/X11/ /etc/X11/ COPY --chown=root:root ./config/X11/ /etc/X11/
RUN find /etc/X11/xorg.conf.d/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';' RUN <<-EOF
RUN find /etc/X11/xorg.conf.d/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';' find /etc/X11/xorg.conf.d/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';'
find /etc/X11/xorg.conf.d/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';'
EOF
# Copy xrdp config # Copy xrdp config
COPY --chown=root:root ./config/xrdp/ /etc/xrdp/ COPY --chown=root:root ./config/xrdp/ /opt/xrdp/etc/xrdp/
RUN find /etc/xrdp/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';' RUN <<-EOF
RUN find /etc/xrdp/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';' find /opt/xrdp/etc/xrdp/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';'
RUN find /etc/xrdp/ -type f -name '*.sh' -not -perm 0755 -exec chmod 0755 '{}' ';' find /opt/xrdp/etc/xrdp/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';'
find /opt/xrdp/etc/xrdp/ -type f -name '*.sh' -not -perm 0755 -exec chmod 0755 '{}' ';'
EOF
# Copy PulseAudio config # Copy PulseAudio config
COPY --chown=root:root ./config/pulse/ /etc/pulse/ COPY --chown=root:root ./config/pulse/ /etc/pulse/
RUN find /etc/pulse/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';' RUN <<-EOF
RUN find /etc/pulse/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';' find /etc/pulse/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';'
find /etc/pulse/ -type f -not -perm 0644 -exec chmod 0644 '{}' ';'
EOF
# Copy scripts # Copy scripts
COPY --chown=root:root ./scripts/bin/ /usr/local/bin/ COPY --chown=root:root ./scripts/bin/ /usr/local/bin/
RUN find /usr/local/bin/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';' RUN <<-EOF
RUN find /usr/local/bin/ -type f -not -perm 0755 -exec chmod 0755 '{}' ';' find /usr/local/bin/ -type d -not -perm 0755 -exec chmod 0755 '{}' ';'
find /usr/local/bin/ -type f -not -perm 0755 -exec chmod 0755 '{}' ';'
EOF
# Expose SSH port # SSH
EXPOSE 3322/tcp EXPOSE 3322/tcp
# Expose RDP port # RDP
EXPOSE 3389/tcp EXPOSE 3389/tcp
ENTRYPOINT ["/usr/bin/catatonit", "--", "/usr/local/bin/container-init"] ENTRYPOINT ["/usr/bin/catatonit", "--", "/usr/local/bin/container-init"]

View File

@@ -1,6 +1,6 @@
# Xubuntu on Docker # Xubuntu on Docker
A Docker image based on Ubuntu 22.04 with the Xfce desktop environment, A Docker image based on Ubuntu 24.04 with the Xfce desktop environment,
[xrdp](https://github.com/neutrinolabs/xrdp), [xrdp](https://github.com/neutrinolabs/xrdp),
[xrdp PulseAudio module](https://github.com/neutrinolabs/pulseaudio-module-xrdp) and [xrdp PulseAudio module](https://github.com/neutrinolabs/pulseaudio-module-xrdp) and
[VirtualGL](https://github.com/VirtualGL/virtualgl). [VirtualGL](https://github.com/VirtualGL/virtualgl).
@@ -25,7 +25,6 @@ docker run \
### Docker Compose ### Docker Compose
```yaml ```yaml
version: '3.9'
services: services:
xubuntu: xubuntu:
image: 'docker.io/hectorm/xubuntu:latest' image: 'docker.io/hectorm/xubuntu:latest'

View File

@@ -0,0 +1,17 @@
#!/bin/sh
# shellcheck disable=SC2034
{
set -a
XDG_DATA_DIRS=/usr/share/xubuntu:/usr/share/xfce4:/usr/local/share:/usr/share
XDG_CONFIG_DIRS=/etc/xdg/xdg-xubuntu:/etc/xdg
XDG_CURRENT_DESKTOP=XFCE
XDG_SESSION_DESKTOP=xubuntu
XDG_SESSION_TYPE=x11
XDG_MENU_PREFIX=xfce-
XDG_DATA_HOME="${HOME:?}"/.local/share
XDG_CONFIG_HOME="${HOME:?}"/.config
XDG_CACHE_HOME="${HOME:?}"/.cache
XDG_RUNTIME_DIR=/run/user/"$(id -u)"
set +a
}

View File

@@ -0,0 +1,4 @@
Section "Files"
ModulePath "/usr/lib/xorg/modules"
ModulePath "/opt/xrdp/lib/xorg/modules"
EndSection

View File

@@ -1,3 +1,3 @@
Package: firefox Package: firefox
Pin: release o=LP-PPA-mozillateam Pin: release o=LP-PPA-mozillateam
Pin-Priority: 900 Pin-Priority: 1000

View File

@@ -1,6 +1,7 @@
Protocol 2 Protocol 2
HostKey /etc/ssh/ssh_host_ed25519_key HostKey /etc/ssh/ssh_host_ed25519_key
HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_rsa_key
ListenAddress 0.0.0.0
ListenAddress ::0 ListenAddress ::0
Port 3322 Port 3322
UseDNS no UseDNS no

View File

@@ -1,6 +1,4 @@
[Globals] [Globals]
ListenAddress=127.0.0.1
ListenPort=3350
EnableUserWindowManager=true EnableUserWindowManager=true
UserWindowManager=startwm.sh UserWindowManager=startwm.sh
DefaultWindowManager=startwm.sh DefaultWindowManager=startwm.sh
@@ -28,7 +26,7 @@ SyslogLevel=INFO
[Xorg] [Xorg]
param=/usr/lib/xorg/Xorg param=/usr/lib/xorg/Xorg
param=-config param=-config
param=xrdp/xorg.conf param=/opt/xrdp/etc/X11/xrdp/xorg.conf
param=-noreset param=-noreset
param=-nolisten param=-nolisten
param=tcp param=tcp
@@ -57,4 +55,5 @@ EnableConsole=true
ConsoleLevel=INFO ConsoleLevel=INFO
[SessionVariables] [SessionVariables]
PULSE_SCRIPT=/etc/xrdp/pulse/default.pa PULSE_SCRIPT=/opt/xrdp/etc/xrdp/pulse/default.pa
PULSE_DLPATH=/opt/xrdp/lib/pulse/modules:/usr/lib/pulse-16.1+dfsg1/modules

4
run.sh
View File

@@ -45,6 +45,10 @@ printf '%s\n' "Creating \"${CONTAINER_NAME:?}\" container..."
--shm-size 2g \ --shm-size 2g \
--publish 3322:3322/tcp \ --publish 3322:3322/tcp \
--publish 3389:3389/tcp \ --publish 3389:3389/tcp \
--mount type=tmpfs,dst=/etc/xrdp/ \
--mount type=tmpfs,dst=/home/ \
--mount type=tmpfs,dst=/tmp/ \
--mount type=tmpfs,dst=/run/ \
${CONTAINER_DEVICES?} \ ${CONTAINER_DEVICES?} \
"${IMAGE_NAME:?}" "$@" >/dev/null "${IMAGE_NAME:?}" "$@" >/dev/null

View File

@@ -104,14 +104,24 @@ if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N '' >/dev/null ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_rsa_key -N '' >/dev/null
fi fi
# Generate xrdp RSA keys if they do not exist
if [ ! -f "${XRDP_RSAKEYS_PATH:?}" ]; then
mkdir -p "$(dirname "${XRDP_RSAKEYS_PATH:?}")"
(umask 077 \
&& xrdp-keygen xrdp "${XRDP_RSAKEYS_PATH:?}" \
) >/dev/null
fi
# Generate RDP certificate if it does not exist # Generate RDP certificate if it does not exist
if [ ! -f "${XRDP_TLS_KEY_PATH:?}" ] || [ ! -f "${XRDP_TLS_CRT_PATH:?}" ]; then if [ ! -f "${XRDP_TLS_KEY_PATH:?}" ] || [ ! -f "${XRDP_TLS_CRT_PATH:?}" ]; then
FQDN=$(hostname --fqdn) FQDN=$(hostname --fqdn)
mkdir -p "$(dirname "${XRDP_TLS_KEY_PATH:?}")"
(umask 077 \ (umask 077 \
&& openssl ecparam -genkey -name prime256v1 > "${XRDP_TLS_KEY_PATH:?}" \ && openssl ecparam -genkey -name prime256v1 > "${XRDP_TLS_KEY_PATH:?}" \
) >/dev/null ) >/dev/null
mkdir -p "$(dirname "${XRDP_TLS_CRT_PATH:?}")"
(umask 022 \ (umask 022 \
&& openssl req -x509 -sha256 -days 3650 -subj "/CN=${FQDN:?}" -addext "subjectAltName=DNS:${FQDN:?}" -key "${XRDP_TLS_KEY_PATH:?}" > "${XRDP_TLS_CRT_PATH:?}" \ && openssl req -x509 -sha256 -days 3650 -subj "/CN=${FQDN:?}" -addext "subjectAltName=DNS:${FQDN:?}" -key "${XRDP_TLS_KEY_PATH:?}" > "${XRDP_TLS_CRT_PATH:?}" \
) >/dev/null ) >/dev/null

View File

@@ -3,4 +3,4 @@
set -eu set -eu
exec 2>&1 exec 2>&1
exec xrdp-sesman --nodaemon exec xrdp-sesman --config /opt/xrdp/etc/xrdp/sesman.ini --nodaemon

View File

@@ -3,4 +3,4 @@
set -eu set -eu
exec 2>&1 exec 2>&1
exec xrdp --nodaemon exec xrdp --config /opt/xrdp/etc/xrdp/xrdp.ini --nodaemon

View File

@@ -9,7 +9,7 @@ RDP_DOMAIN=Xorg
RDP_USER=user RDP_USER=user
RDP_PASSWORD=password RDP_PASSWORD=password
exec xfreerdp \ exec xfreerdp3 \
/v:"${RDP_HOST:?}":"${RDP_PORT:?}" \ /v:"${RDP_HOST:?}":"${RDP_PORT:?}" \
/u:"${RDP_DOMAIN:?}"\\"${RDP_USER:?}" /p:"${RDP_PASSWORD:?}" \ /u:"${RDP_DOMAIN:?}"\\"${RDP_USER:?}" /p:"${RDP_PASSWORD:?}" \
/log-level:INFO /cert:ignore \ /log-level:INFO /cert:ignore \