From 017fc3959a0bb626bcbe2af534b321af859fc6be Mon Sep 17 00:00:00 2001
From: Dominique Marcadet <dominique.marcadet@centralesupelec.fr>
Date: Mon, 22 May 2023 15:50:43 +0200
Subject: [PATCH] initial xfce version

---
 Dockerfile                           | 39 ++++++++++++++++++++++++++++
 Makefile                             |  8 ++++++
 README.md                            | 21 ++++++++++-----
 root/usr/local/lib/wrapper_script.sh | 12 +++++++++
 4 files changed, 74 insertions(+), 6 deletions(-)
 create mode 100644 Dockerfile
 create mode 100644 Makefile
 create mode 100755 root/usr/local/lib/wrapper_script.sh

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..608dcc4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,39 @@
+FROM --platform=${TARGETPLATFORM} lscr.io/linuxserver/webtop:ubuntu-xfce
+
+## environment settings
+ENV HOME="/config"
+ENV TZ=Europe/Paris
+ARG DEBIAN_FRONTEND=noninteractive
+
+RUN \
+  echo "**** install needed tools and dependencies ****" && \
+  apt-get update && \
+  apt-get upgrade -y && \
+  apt-get install -y \
+    nextcloud-desktop \
+    unzip \
+    zip
+
+RUN \
+  echo "**** clean up ****" && \
+  apt-get clean && \
+  rm -rf \
+    /tmp/* \
+    /var/lib/apt/lists/* \
+    /var/tmp/*
+
+## add local files
+COPY /root /
+
+## /config will be a docker volume, initially empty
+## wrapper_script will do the copy from /init-config
+## but /config must exist fort the mount
+RUN \
+    chown -R abc:abc /config && \
+    mv /config /init-config && \
+    mkdir /config && \
+    chown -R abc:abc /config
+
+## launch
+ENTRYPOINT ["/bin/bash", "/usr/local/lib/wrapper_script.sh"]
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..84c6e7a
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+
+REPO = gitlab-research.centralesupelec.fr:4567/my-docker-images/docker-webtop
+TAG  = xfce
+
+all:
+	docker buildx create --use --node new-builder
+	docker buildx build --push --platform "linux/amd64" --tag "${REPO}:${TAG}" .
+
diff --git a/README.md b/README.md
index 26bdfe5..593ac45 100644
--- a/README.md
+++ b/README.md
@@ -3,16 +3,25 @@
 
 ## Why
 
-This image is a base image for a full linux running either on a local docker or on MyDocker. 
+This image is a base image for a linux with a GUI running either on a local docker or on MyDocker. 
 It is based on [WebTop image from LinuxServer.io](https://github.com/linuxserver/docker-webtop) 
 which is maintained and quite often updated.
 
+This image use Ubuntu 22.04 and the [Xfce](https://www.xfce.org) window manager.
+
 ## Changes
 
-- For deployment on MyDocker, an nginx WebSocket reverse proxy with http basic authentification 
-has been added. Trying to use the PASSWORD setting of [guacamole client From Linuxserver](https://github.com/linuxserver/gclient) 
-was not succesful.
+- Nextcloud and some basic tools (unzip, zip) added.
+
+## Details
 
-## Usage
+- The exposed ports are 3000 (HTTP/VNC) and 3001 (HTTPS/VNC).
+- The user folder is `/config`.
+- the user is `abc`, its password also, sudo is without password.
+- if docker is installed on your computer, you can run (amd64 or arm64 architecture) this 
+  image, assuming you are in a specific folder that will be shared with the container at 
+  `/config`, with:
+  
+  `docker run -p 3000:3000 -v "$(pwd):/config"
+    gitlab-research.centralesupelec.fr:4567/my-docker-images/docker-webtop:xfce`
 
-- Choose one of the available branch (`kde` or `icewm`).
diff --git a/root/usr/local/lib/wrapper_script.sh b/root/usr/local/lib/wrapper_script.sh
new file mode 100755
index 0000000..c500923
--- /dev/null
+++ b/root/usr/local/lib/wrapper_script.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+cp    -TRn /init-config/ /config
+chown -R   abc:abc       /config
+
+# MyDocker send a username to $1 and a password to $2
+if [ "$2" ]; then
+    export CUSTOM_USER=$1
+    export PASSWORD=$2
+fi
+
+exec /init
-- 
GitLab