From 9d1d1e922b94491a55c3edaff24b9ad405dabc3d Mon Sep 17 00:00:00 2001 From: "Rene Vergara A." Date: Wed, 26 Jun 2024 11:55:31 -0400 Subject: [PATCH] dkr002 - Docker Image creation Standard (GUI) an expert mode added to docker image --- docker_files/Dockerfile | 41 +++++-------------- docker_files/Dockerfile_tightvnc | 69 -------------------------------- docker_files/runzenith | 18 +++++++-- docker_files/startzen | 6 +++ 4 files changed, 30 insertions(+), 104 deletions(-) delete mode 100644 docker_files/Dockerfile_tightvnc create mode 100755 docker_files/startzen diff --git a/docker_files/Dockerfile b/docker_files/Dockerfile index 839426e..3418170 100644 --- a/docker_files/Dockerfile +++ b/docker_files/Dockerfile @@ -1,5 +1,7 @@ +# ===================================================== +# Zenith Full Node Wallet +# ===================================================== FROM ubuntu:22.04 -MAINTAINER Rene V. Vergara A. RUN apt update @@ -7,15 +9,8 @@ RUN apt update ENV DEBIAN_FRONTEND=noninteractive # Update the package list and install necessary packages -RUN apt-get install -y \ - xfce4 \ - xfce4-goodies \ - tigervnc-standalone-server \ - dbus-x11 \ - xfonts-base \ - xterm \ - wget - +RUN apt-get install -qqy xterm x11-apps + RUN apt-get install -y \ libxss-dev \ libxrandr-dev \ @@ -27,25 +22,9 @@ RUN apt-get install -y \ RUN apt-get clean \ && rm -rf /var/lib/apt/lists/* - # Create a new user (e.g., "zenusr") and set a password RUN useradd -ms /bin/bash zenusr RUN echo "1234\n1234\n" | passwd zenusr -RUN usermod -aG sudo zenusr - -# Create an.Xauthority file -RUN touch /home/zenusr/.Xauthority -RUN chown zenusr:zenusr /home/zenusr/.Xauthority - -# Configure VNC server -RUN mkdir -p /home/zenusr/.vnc -RUN echo "vnc1234" | vncpasswd -f > /home/zenusr/.vnc/passwd -RUN chmod 600 /home/zenusr/.vnc/passwd - -# Create startup script for VNC seriver -RUN echo '#!/bin/bash\nxrdb /home/zenusr/.Xresources\nstartxfce4 &' > /home/zenusr/.vnc/xstartup -RUN chmod +x /home/zenusr/.vnc/xstartup -RUN chown zenusr:zenusr -R /home/zenusr/.vnc RUN mkdir /home/zenusr/assets COPY assets/* /home/zenusr/assets/ @@ -54,6 +33,7 @@ RUN chown zenusr:zenusr -R /home/zenusr/assets COPY bash_rc_adm /root/.bashrc COPY bash_rc_usr /home/zenusr/.bashrc COPY zenith /usr/local/bin +COPY startzen /usr/local/bin COPY librustzcash_wrapper.so /usr/local/lib COPY sapling-spend.params /usr/local/lib COPY sapling-output.params /usr/local/lib @@ -65,13 +45,12 @@ RUN echo '#!/bin/bash\ncd /home/zenusr/Downloads\ndpkg -i libc6_2.38-1ubuntu6_am RUN chmod +x /usr/local/bin/updlibc RUN updlibc -RUN echo '#!/bin/bash\nvncserver -geometry 1360x768 -depth 24 -SendCutText' > /usr/local/bin/startvnc -RUN chmod +x /usr/local/bin/startvnc +#RUN echo '#!/bin/bash\nvncserver -geometry 1360x768 -depth 24 -SendCutText' > /usr/local/bin/startvnc +#RUN chmod +x /usr/local/bin/startvnc # Set the user to "zenusr" -#USER zenusr +USER zenusr WORKDIR /home/zenusr ENV USER=zenusr - -CMD ["/bin/bash"] +CMD ["startzen"] \ No newline at end of file diff --git a/docker_files/Dockerfile_tightvnc b/docker_files/Dockerfile_tightvnc deleted file mode 100644 index a34b898..0000000 --- a/docker_files/Dockerfile_tightvnc +++ /dev/null @@ -1,69 +0,0 @@ -FROM ubuntu:22.04 -MAINTAINER Rene V. Vergara A. - -RUN apt update - -# Set environment variables to non-interactive mode for installation -ENV DEBIAN_FRONTEND=noninteractive - -# Update the package list and install necessary packages -RUN apt-get install -y \ - xfce4 \ - xfce4-goodies \ - tightvncserver \ - xterm \ - wget - -# Install your GUI application (example: Firefox) -# RUN apt-get install -y firefox - -RUN apt-get install -y \ - libxss-dev \ - libxrandr-dev \ - libsecp256k1-dev \ - xclip \ - libglew-dev \ - libsdl2-dev - -RUN apt-get clean \ - && rm -rf /var/lib/apt/lists/* - -# Create a new user (e.g., "zenusr") and set a password -RUN useradd -ms /bin/bash zenusr -RUN echo "1234\n1234\n" | passwd zenusr -RUN usermod -aG sudo zenusr - -# Configure VNC server -RUN mkdir -p /home/zenusr/.vnc -RUN echo "vnc1234" | vncpasswd -f > /home/zenusr/.vnc/passwd -RUN chmod 600 /home/zenusr/.vnc/passwd - -# Create startup script for VNC seriver -RUN echo -e '#!/bin/bash\nxrdb $HOME/.Xresources\nstartxfce4 &' > /home/zenusr/.vnc/xstartup -RUN chmod +x /home/zenusr/.vnc/xstartup -RUN chown zenusr:zenusr -R /home/zenusr/.vnc - -COPY bash_rc_adm /root/.bashrc -COPY bash_rc_usr /home/zenusr/.bashrc -COPY zenith /usr/local/bin -COPY librustzcash_wrapper.so /usr/local/lib -COPY sapling-spend.params /usr/local/lib -COPY sapling-output.params /usr/local/lib -COPY libc-bin_2.38-1ubuntu6_amd64.deb /home/zenusr/Downloads/ -COPY libc-dev-bin_2.38-1ubuntu6_amd64.deb /home/zenusr/Downloads/ -COPY libc6_2.38-1ubuntu6_amd64.deb /home/zenusr/Downloads/ - -RUN echo -e '#!/bin/bash\ncd /home/zenusr/Downloads\ndpkg -i libc6_2.38-1ubuntu6_amd64.deb libc-bin_2.38-1ubuntu6_amd64.deb libc-dev-bin_2.38-1ubuntu6_amd64.deb' > /usr/local/bin/updlibc -RUN chmod +x /usr/local/bin/updlibc -RUN updlibc - -RUN echo -e '#!/bin/bash\nvncserver -geometry 1360x768 -depth 24' > /usr/local/bin/startvnc -RUN chmod +x /usr/local/bin/startvnc - -# Set the user to "zenusr" -USER zenusr -WORKDIR /home/zenusr -ENV USER=zenusr - - -CMD ["/bin/bash"] diff --git a/docker_files/runzenith b/docker_files/runzenith index b3a4842..50d66f2 100755 --- a/docker_files/runzenith +++ b/docker_files/runzenith @@ -1,6 +1,17 @@ #!/bin/bash ZFOLDER=~/Zenith -IMAGE_NAME=zenith-docker-gui:0.5.3.0 +IMAGE_NAME=zenith-docker:0.6.0.0x + +for i in "$@" +do case $i in + -e=*|--expert=*) + EXPERTMODE="1" + ;; + *) + EXPERTMODE="0" + ;; +esac +done # Check if data folder exists if [ ! -d "$ZFOLDER" ]; then @@ -18,7 +29,6 @@ if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ]]; then exit fi -docker run -it --mount src=$ZFOLDER,target=/home/zenith,type=bind --net=host $IMAGE_NAME +docker run --rm -it --mount src=$ZFOLDER,target=/home/zenith,type=bind --net=host --env DISPLAY=$DISPLAY --env EXPERT_MODE=$EXPERTMODE $IMAGE_NAME -# End - +# End \ No newline at end of file diff --git a/docker_files/startzen b/docker_files/startzen new file mode 100755 index 0000000..24ab52f --- /dev/null +++ b/docker_files/startzen @@ -0,0 +1,6 @@ +#!/bin/bash +if [ x"${EXPERT_MODE}" == "x" ]; then + zenith gui + else + xterm -geometry 90x55 -fs 10 -fa DejaVuSansMono -cr green -bg black -fg lightgray +fi \ No newline at end of file