From 336186d62681f5eeb04d705041717f47dc9ddc06 Mon Sep 17 00:00:00 2001 From: Mario Romero Date: Thu, 21 Sep 2023 02:15:01 -0300 Subject: [PATCH] Base web image working --- base/arch.Dockerfile | 2 +- ...web-arch.Dockerfile => webarch.Dockerfile} | 21 +++++++++++------- include/desktopinit.desktop | 4 ++++ {media => include/media}/defaultwallpaper.png | Bin scripts/desktopinit | 2 ++ scripts/startserver | 16 +++++++++++++ 6 files changed, 36 insertions(+), 9 deletions(-) rename base/{web-arch.Dockerfile => webarch.Dockerfile} (64%) create mode 100644 include/desktopinit.desktop rename {media => include/media}/defaultwallpaper.png (100%) create mode 100644 scripts/desktopinit create mode 100644 scripts/startserver diff --git a/base/arch.Dockerfile b/base/arch.Dockerfile index 075e793..08f7ce1 100644 --- a/base/arch.Dockerfile +++ b/base/arch.Dockerfile @@ -27,7 +27,7 @@ ENV USER designer # Add scripts RUN mkdir -p .scripts -COPY --chown=designer:designer --chmod=755 scripts/klayout /home/designer/.scripts +COPY --chown=designer:designer --chmod=755 scripts/* /home/designer/.scripts ENV PATH="/home/designer/.scripts:${PATH}" # Initialize the enviroment keeping container alive diff --git a/base/web-arch.Dockerfile b/base/webarch.Dockerfile similarity index 64% rename from base/web-arch.Dockerfile rename to base/webarch.Dockerfile index bae612e..7c79176 100644 --- a/base/web-arch.Dockerfile +++ b/base/webarch.Dockerfile @@ -9,23 +9,28 @@ RUN sudo pacman -Syuq --noconfirm RUN paru -S --noconfirm kasmvncserver-bin # KASM requires the hostname binary to start -RUN pacman -S --noconfirm inetutils +RUN sudo pacman -S --noconfirm inetutils # KASM requires the "snakeoil" certificate key for SSL authentication # This key comes from default in debian based distributions # For archlinux this will need to be created manually WORKDIR /etc/ssl RUN sudo openssl genpkey -algorithm RSA -out private/ssl-cert-snakeoil.key -RUN sudo openssl req -new -key private/ssl-cert-snakeoil.key -out certs/ssl-cert-snakeoil.csr -subj "CN=localhost" +RUN sudo openssl req -new -key private/ssl-cert-snakeoil.key -out certs/ssl-cert-snakeoil.csr -subj "/CN=localhost" RUN sudo openssl x509 -req -days 365 -in certs/ssl-cert-snakeoil.csr -signkey private/ssl-cert-snakeoil.key -out certs/ssl-cert-snakeoil.pem RUN sudo chmod 640 private/ssl-cert-snakeoil.key RUN sudo chmod 644 certs/ssl-cert-snakeoil.pem RUN sudo usermod -aG root designer -# Set desktop wallpaper -RUN mkdir /home/designer/.media -COPY media/defaultwallpaper.png /home/designer/.media -RUN setwallpaper /home/designer/.media/defaultwallpaper.png +# Install XFCE +RUN sudo pacman -S --noconfirm xorg xfce4 -# Run VNC server & desktop environment -CMD["vncserver", "-select-de", "xfce"] +# Copy includes +RUN mkdir -p /home/designer/.media +COPY --chown=designer:designer include/media/* /home/designer/.media +RUN mkdir -p /home/designer/.config/autostart +COPY --chown=designer:designer include/desktopinit.desktop /home/designer/.config/autostart + +# Start VNC & desktop environment +WORKDIR /home/designer +ENTRYPOINT ["startserver"] diff --git a/include/desktopinit.desktop b/include/desktopinit.desktop new file mode 100644 index 0000000..af16160 --- /dev/null +++ b/include/desktopinit.desktop @@ -0,0 +1,4 @@ +[Desktop Entry] +Type=Application +Name=OSICStacks-DesktopInit +Exec=sh -c "sleep 1 && desktopinit" diff --git a/media/defaultwallpaper.png b/include/media/defaultwallpaper.png similarity index 100% rename from media/defaultwallpaper.png rename to include/media/defaultwallpaper.png diff --git a/scripts/desktopinit b/scripts/desktopinit new file mode 100644 index 0000000..32b1fe0 --- /dev/null +++ b/scripts/desktopinit @@ -0,0 +1,2 @@ +#!/bin/bash +setwallpaper /home/designer/.media/defaultwallpaper.png diff --git a/scripts/startserver b/scripts/startserver new file mode 100644 index 0000000..5932175 --- /dev/null +++ b/scripts/startserver @@ -0,0 +1,16 @@ +#!/bin/bash +cd /home/designer + +# Run VNC server +export DISPLAY=:1 +eval $(vncserver -dry-run) & +echo -e "password\npassword\n" | vncpasswd -u designer -w -r + +# Wait for VNC server to start +sleep 1 + +# Run desktop environment (XFCE) +xfce4-session --display=$DISPLAY + +# Keep container alive +sleep infinity