Skip to content

Commit

Permalink
updating arch to new format and adding dri3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
thelamer committed Mar 8, 2023
1 parent 0761ab4 commit 370ccab
Show file tree
Hide file tree
Showing 12 changed files with 134 additions and 35 deletions.
53 changes: 42 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,36 @@
# syntax=docker/dockerfile:1

FROM node:12-buster as wwwstage

ARG KASMWEB_RELEASE="master"

RUN \
echo "**** build clientside ****" && \
export QT_QPA_PLATFORM=offscreen && \
export QT_QPA_FONTDIR=/usr/share/fonts && \
mkdir /src && \
cd /src && \
wget https://github.com/kasmtech/noVNC/tarball/${KASMWEB_RELEASE} -O - \
| tar --strip-components=1 -xz && \
npm install && \
npm run-script build

RUN \
echo "**** organize output ****" && \
mkdir /build-out && \
cd /src && \
rm -rf node_modules/ && \
cp -R ./* /build-out/ && \
cd /build-out && \
rm *.md && \
rm AUTHORS && \
cp index.html vnc.html

FROM ghcr.io/linuxserver/baseimage-arch:latest as buildstage

ARG KASMVNC_RELEASE="1.0.1"
ARG KASMWEB_RELEASE="develop"
ARG KASMVNC_RELEASE="master"

COPY --from=wwwstage /build-out /www

RUN \
echo "**** install build deps ****" && \
Expand Down Expand Up @@ -31,6 +58,7 @@ RUN \
libxrandr \
libxshmfence \
libxtst \
mesa \
mesa-libgl \
meson \
patch \
Expand Down Expand Up @@ -64,14 +92,14 @@ RUN \
. && \
make -j4 && \
echo "**** build xorg ****" && \
XORG_VER="1.20.7" && \
XORG_VER="1.20.14" && \
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##') && \
wget --no-check-certificate \
-O /tmp/xorg-server-${XORG_VER}.tar.bz2 \
"https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2" && \
-O /tmp/xorg-server-${XORG_VER}.tar.gz \
"https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.gz" && \
tar --strip-components=1 \
-C unix/xserver \
-xf /tmp/xorg-server-${XORG_VER}.tar.bz2 && \
-xf /tmp/xorg-server-${XORG_VER}.tar.gz && \
cd unix/xserver && \
patch -Np1 -i ../xserver${XORG_PATCH}.patch && \
patch -s -p0 < ../CVE-2022-2320-v1.20.patch && \
Expand All @@ -98,7 +126,7 @@ RUN \
--disable-dri2 \
--enable-glx \
--disable-xwayland \
--disable-dri3 && \
--enable-dri3 && \
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; && \
make -j4 && \
echo "**** generate final output ****" && \
Expand All @@ -115,8 +143,7 @@ RUN \
ln -s /usr/lib64/dri dri && \
cd /src && \
mkdir -p builder/www && \
curl -s https://kasm-ci.s3.amazonaws.com/kasmweb-${KASMWEB_RELEASE}.tar.gz \
| tar xzf - -C builder/www && \
cp -ax /www/* builder/www/ && \
cp builder/www/index.html builder/www/vnc.html && \
make servertarball && \
mkdir /build-out && \
Expand All @@ -138,12 +165,11 @@ RUN \
nodejs \
npm \
python3


RUN \
echo "**** grab source ****" && \
mkdir -p /kclient && \
if [ -z ${GCLIENT_RELEASE+x} ]; then \
if [ -z ${KCLIENT_RELEASE+x} ]; then \
KCLIENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/kclient/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
Expand Down Expand Up @@ -194,6 +220,8 @@ RUN \
libva-mesa-driver \
libwebp \
libxfont2 \
libxshmfence \
mesa \
mesa-libgl \
nginx \
nodejs \
Expand All @@ -215,6 +243,8 @@ RUN \
xf86-video-amdgpu \
xf86-video-ati \
xf86-video-intel \
xf86-video-nouveau \
xf86-video-qxl \
xkeyboard-config \
xorg-setxkbmap \
xorg-xauth \
Expand Down Expand Up @@ -261,6 +291,7 @@ RUN \
locale-gen && \
sed -i '$d' /etc/nginx/nginx.conf && \
echo "include /etc/nginx/conf.d/*;}" >> /etc/nginx/nginx.conf && \
mkdir -p /etc/nginx/conf.d && \
echo "**** cleanup ****" && \
pacman -Rsn --noconfirm \
git \
Expand Down
58 changes: 47 additions & 11 deletions Dockerfile.aarch64
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
# syntax=docker/dockerfile:1

FROM node:12-buster as wwwstage

ARG KASMWEB_RELEASE="master"

RUN \
echo "**** install build deps ****" && \
apt-get update && \
apt-get install -y phantomjs

RUN \
echo "**** build clientside ****" && \
export QT_QPA_PLATFORM=offscreen && \
export QT_QPA_FONTDIR=/usr/share/fonts && \
mkdir /src && \
cd /src && \
wget https://github.com/kasmtech/noVNC/tarball/${KASMWEB_RELEASE} -O - \
| tar --strip-components=1 -xz && \
npm install && \
npm run-script build

RUN \
echo "**** organize output ****" && \
mkdir /build-out && \
cd /src && \
rm -rf node_modules/ && \
cp -R ./* /build-out/ && \
cd /build-out && \
rm *.md && \
rm AUTHORS && \
cp index.html vnc.html

FROM ghcr.io/linuxserver/baseimage-arch:arm64v8-latest as buildstage

ARG KASMVNC_RELEASE="1.0.1"
ARG KASMWEB_RELEASE="develop"
ARG KASMVNC_RELEASE="master"

COPY --from=wwwstage /build-out /www

RUN \
echo "**** install build deps ****" && \
Expand Down Expand Up @@ -31,6 +63,7 @@ RUN \
libxrandr \
libxshmfence \
libxtst \
mesa \
mesa-libgl \
meson \
patch \
Expand Down Expand Up @@ -64,14 +97,14 @@ RUN \
. && \
make -j4 && \
echo "**** build xorg ****" && \
XORG_VER="1.20.7" && \
XORG_VER="1.20.14" && \
XORG_PATCH=$(echo "$XORG_VER" | grep -Po '^\d.\d+' | sed 's#\.##') && \
wget --no-check-certificate \
-O /tmp/xorg-server-${XORG_VER}.tar.bz2 \
"https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.bz2" && \
-O /tmp/xorg-server-${XORG_VER}.tar.gz \
"https://www.x.org/archive/individual/xserver/xorg-server-${XORG_VER}.tar.gz" && \
tar --strip-components=1 \
-C unix/xserver \
-xf /tmp/xorg-server-${XORG_VER}.tar.bz2 && \
-xf /tmp/xorg-server-${XORG_VER}.tar.gz && \
cd unix/xserver && \
patch -Np1 -i ../xserver${XORG_PATCH}.patch && \
patch -s -p0 < ../CVE-2022-2320-v1.20.patch && \
Expand All @@ -98,7 +131,7 @@ RUN \
--disable-dri2 \
--enable-glx \
--disable-xwayland \
--disable-dri3 && \
--enable-dri3 && \
find . -name "Makefile" -exec sed -i 's/-Werror=array-bounds//g' {} \; && \
make -j4 && \
echo "**** generate final output ****" && \
Expand All @@ -115,8 +148,7 @@ RUN \
ln -s /usr/lib/dri dri && \
cd /src && \
mkdir -p builder/www && \
curl -s https://kasm-ci.s3.amazonaws.com/kasmweb-${KASMWEB_RELEASE}.tar.gz \
| tar xzf - -C builder/www && \
cp -ax /www/* builder/www/ && \
cp builder/www/index.html builder/www/vnc.html && \
make servertarball && \
mkdir /build-out && \
Expand All @@ -138,12 +170,11 @@ RUN \
nodejs \
npm \
python3


RUN \
echo "**** grab source ****" && \
mkdir -p /kclient && \
if [ -z ${GCLIENT_RELEASE+x} ]; then \
if [ -z ${KCLIENT_RELEASE+x} ]; then \
KCLIENT_RELEASE=$(curl -sX GET "https://api.github.com/repos/linuxserver/kclient/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]'); \
fi && \
Expand Down Expand Up @@ -193,6 +224,8 @@ RUN \
libva-mesa-driver \
libwebp \
libxfont2 \
libxshmfence \
mesa \
mesa-libgl \
nginx \
nodejs \
Expand All @@ -211,6 +244,8 @@ RUN \
sudo \
vulkan-radeon \
xf86-video-amdgpu \
xf86-video-nouveau \
xf86-video-qxl \
xkeyboard-config \
xorg-setxkbmap \
xorg-xauth \
Expand Down Expand Up @@ -257,6 +292,7 @@ RUN \
locale-gen && \
sed -i '$d' /etc/nginx/nginx.conf && \
echo "include /etc/nginx/conf.d/*;}" >> /etc/nginx/nginx.conf && \
mkdir -p /etc/nginx/conf.d && \
echo "**** cleanup ****" && \
pacman -Rsn --noconfirm \
git \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
server {
#auth_basic "Login";
#auth_basic_user_file /etc/nginx/.htpasswd;
listen 3000 default_server;
listen [::]:3000 default_server;
location / {
Expand Down Expand Up @@ -47,6 +49,8 @@ server {
}

server {
#auth_basic "Login";
#auth_basic_user_file /etc/nginx/.htpasswd;
listen 3001 ssl;
listen [::]:3001 ssl;
ssl_certificate /config/ssl/cert.pem;
Expand Down
12 changes: 0 additions & 12 deletions root/etc/s6-overlay/s6-rc.d/init-keygen/run

This file was deleted.

1 change: 0 additions & 1 deletion root/etc/s6-overlay/s6-rc.d/init-keygen/up

This file was deleted.

30 changes: 30 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/init-nginx/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/with-contenv bash

# nginx Path
NGINX_CONFIG=/etc/nginx/conf.d/default.conf

# user passed env vars
CPORT="${CUSTOM_PORT:-3000}"
CHPORT="${CUSTOM_HTTPS_PORT:-3001}"
CUSER="${CUSTOM_USER:-abc}"

# create self signed cert
if [ ! -f "/config/ssl/cert.pem" ]; then
mkdir -p /config/ssl
openssl req -new -x509 \
-days 3650 -nodes \
-out /config/ssl/cert.pem \
-keyout /config/ssl/cert.key \
-subj "/C=US/ST=CA/L=Carlsbad/O=Linuxserver.io/OU=LSIO Server/CN=*"
chmod 600 /config/ssl/cert.key
chown -R abc:abc /config/ssl
fi

# modify nginx config
cp /defaults/default.conf ${NGINX_CONFIG}
sed -i "s/3000/$CPORT/g" ${NGINX_CONFIG}
sed -i "s/3001/$CHPORT/g" ${NGINX_CONFIG}
if [ ! -z ${PASSWORD+x} ]; then
printf "${CUSER}:$(openssl passwd -apr1 ${PASSWORD})\n" > /etc/nginx/.htpasswd
sed -i 's/#//g' ${NGINX_CONFIG}
fi
File renamed without changes.
1 change: 1 addition & 0 deletions root/etc/s6-overlay/s6-rc.d/init-nginx/up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/etc/s6-overlay/s6-rc.d/init-nginx/run
10 changes: 10 additions & 0 deletions root/etc/s6-overlay/s6-rc.d/svc-kasmvnc/run
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
#!/usr/bin/with-contenv bash

# Pass gpu flags if mounted
if [ -e /dev/dri/renderD* ]; then
HW3D="-hw3d"
fi
if [ -z ${DRINODE+x} ]; then
DRINODE="/dev/dri/renderD128"
fi

s6-setuidgid abc \
/usr/local/bin/Xvnc $DISPLAY \
${HW3D} \
-drinode ${DRINODE} \
-disableBasicAuth \
-SecurityTypes None \
-AlwaysShared \
Expand Down

0 comments on commit 370ccab

Please sign in to comment.