Skip to content

Commit

Permalink
Added mostly working gnome-shell dockerfile with the extension instal…
Browse files Browse the repository at this point in the history
…led. However, the extension is showing errors loading, but logs show nothing.
  • Loading branch information
chrisspen committed Apr 7, 2021
1 parent f0e2662 commit 63bd774
Show file tree
Hide file tree
Showing 16 changed files with 158 additions and 371 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
_build
archlinux
dist
*.out
67 changes: 0 additions & 67 deletions Dockerfile.ubuntu1804

This file was deleted.

102 changes: 102 additions & 0 deletions Dockerfile.ubuntu2004
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Courtesy of https://github.com/darkdragon-001/Dockerfile-Ubuntu-Gnome
FROM ubuntu:20.04

ENV container docker
ENV DEBIAN_FRONTEND noninteractive

# Install locale
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
RUN apt-get update && apt-get install -y --no-install-recommends \
locales && \
echo "$LANG UTF-8" >> /etc/locale.gen && \
locale-gen && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install systemd
RUN apt-get update && apt-get install -y \
dbus dbus-x11 systemd && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* &&\
dpkg-divert --local --rename --add /sbin/udevadm &&\
ln -s /bin/true /sbin/udevadm
# TODO maybe disable other targets: https://developers.redhat.com/blog/2014/05/05/running-systemd-within-docker-container/
RUN systemctl disable systemd-resolved
VOLUME ["/sys/fs/cgroup"]
STOPSIGNAL SIGRTMIN+3
CMD [ "/sbin/init" ]

# Install GNOME
# NOTE if you want plain gnome, use: apt-get install -y --no-install-recommends gnome-session gnome-terminal and remove the modification of /etc/gdm3/custom.conf
RUN apt-get update \
&& apt-get install -y ubuntu-desktop fcitx-config-gtk gnome-tweak-tool gnome-usage git \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& sed -i 's/\[daemon\]/[daemon]\nInitialSetupEnable=false/' /etc/gdm3/custom.conf

# Install applet dependencies.
RUN apt-get update \
&& apt-get install -y gir1.2-gtop-2.0 gir1.2-nm-1.0 gir1.2-clutter-1.0

# Install TigerVNC server
# TODO set VNC port in service file > exec command
# TODO check if it works with default config file
# NOTE tigervnc because of XKB extension: https://github.com/i3/i3/issues/1983
RUN apt-get update \
&& apt-get install -y tigervnc-common tigervnc-scraping-server tigervnc-standalone-server tigervnc-viewer tigervnc-xorg-extension \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# TODO fix PID problem: Type=forking would be best, but system daemon is run as root on startup
# ERROR tigervnc@:1.service: New main PID 233 does not belong to service, and PID file is not owned by root. Refusing.
# https://www.freedesktop.org/software/systemd/man/systemd.service.html#Type=
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Specifiers
# https://wiki.archlinux.org/index.php/TigerVNC#Starting_and_stopping_vncserver_via_systemd
# -> this should be fixed by official systemd file once released: https://github.com/TigerVNC/tigervnc/pull/838
# TODO specify options like geometry as environment variables -> source variables in service via EnvironmentFile=/path/to/env
# NOTE logout will stop tigervnc service -> need to manually start (gdm for graphical login is not working)
COPY [email protected] /etc/systemd/system/[email protected]
RUN systemctl enable tigervnc@:1
EXPOSE 5901

# Install noVNC
# TODO novnc depends on net-tools until version 1.1.0: https://github.com/novnc/noVNC/issues/1075
RUN apt-get update && apt-get install -y \
net-tools novnc \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/share/novnc/vnc_lite.html /usr/share/novnc/index.html
# TODO specify options like ports as environment variables -> source variables in service via EnvironmentFile=/path/to/env
COPY novnc.service /etc/systemd/system/novnc.service
RUN systemctl enable novnc
EXPOSE 6901

# Create unprivileged user
# NOTE user hardcoded in tigervnc.service
# NOTE alternative is to use libnss_switch and create user at runtime -> use entrypoint script
ARG UID=1000
ARG USER=default
RUN useradd ${USER} -u ${UID} -U -d /home/${USER} -m -s /bin/bash
RUN apt-get update && apt-get install -y sudo && apt-get clean && rm -rf /var/lib/apt/lists/* && \
echo "${USER} ALL=(ALL) NOPASSWD: ALL" > "/etc/sudoers.d/${USER}" && \
chmod 440 "/etc/sudoers.d/${USER}"
USER "${USER}"
ENV USER="${USER}" \
HOME="/home/${USER}"
WORKDIR "/home/${USER}"

# Disable annoying Gnome welcome screen.
RUN sudo bash -c 'echo "X-GNOME-Autostart-enabled=false" >> /etc/xdg/autostart/gnome-initial-setup-first-login.desktop'

# Install extension.
RUN mkdir -p $HOME/.local/share/gnome-shell/extensions
COPY ./[email protected] $HOME/.local/share/gnome-shell/extensions/[email protected]
RUN gnome-extensions enable [email protected]

# Set up VNC
RUN mkdir -p $HOME/.vnc
COPY xstartup $HOME/.vnc/xstartup
RUN echo "acoman" | vncpasswd -f >> $HOME/.vnc/passwd && chmod 600 $HOME/.vnc/passwd

# switch back to root to start systemd
USER root
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ extract the archive, open a shell into its directory, and run:
Alternately, if you plan on doing development on the extension, or testing modifications, it's advised you checkout the Git repository and install a symlink. First, install git if you don't have it: (sudo apt-get install git-core, sudo pacman -S git, etc), then run:

GIT_PROJECTS=~/git_projects
PROJECT_NAME=system-monitor@paradoxxx.zero.gmail.com
PROJECT_NAME=gnome-shell-system-monitor-applet
mkdir $GIT_PROJECTS
cd $GIT_PROJECTS
git clone git://github.com/paradoxxxzero/gnome-shell-system-monitor-applet.git $PROJECT_NAME
Expand All @@ -82,6 +82,7 @@ Alternately, if you plan on doing development on the extension, or testing modif
{ [ -d "./$PROJECT_NAME" ] || [ -L "./$PROJECT_NAME" ]; } && rm -Rf "./$PROJECT_NAME"
ln -s $GIT_PROJECTS/gnome-shell-system-monitor-applet/$PROJECT_NAME
gnome-shell-extension-tool --enable-extension=$PROJECT_NAME
gnome-extensions enable [email protected]

And restart gnome-shell (`Alt + F2`, then `r`) or reboot the machine.

Expand Down
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -e

if [ -z "$USER" ]; then
USER=$(whoami)
fi

sudo docker build -t $USER/vnc-gnome \
--build-arg GID=$(id -g $USER) \
--build-arg UID=$(id -u $USER) \
--build-arg USER=$USER .
15 changes: 0 additions & 15 deletions gnome-docker-fix-and-customise.sh

This file was deleted.

125 changes: 0 additions & 125 deletions gnome-keybindings.pl

This file was deleted.

10 changes: 0 additions & 10 deletions gnome-keybindings.sh

This file was deleted.

2 changes: 2 additions & 0 deletions lg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.lookingGlass.toggle();'
11 changes: 11 additions & 0 deletions novnc.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=noVNC remote desktop server
After=tigervnc@:1.service

[Service]
Type=simple
User=default
ExecStart=/usr/share/novnc/utils/launch.sh --vnc localhost:5901 --listen 6901

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions reload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
busctl --user call org.gnome.Shell /org/gnome/Shell org.gnome.Shell Eval s 'Meta.restart("Restarting...")'
12 changes: 0 additions & 12 deletions spawn-desktop.sh

This file was deleted.

Loading

0 comments on commit 63bd774

Please sign in to comment.