dkr002 - Docker Image creation

Standard (GUI) an expert mode added to docker image
This commit is contained in:
Rene V. Vergara A. 2024-06-26 11:55:31 -04:00
parent c118e168c1
commit 9d1d1e922b
4 changed files with 30 additions and 104 deletions

View file

@ -1,5 +1,7 @@
# =====================================================
# Zenith Full Node Wallet
# =====================================================
FROM ubuntu:22.04 FROM ubuntu:22.04
MAINTAINER Rene V. Vergara A. <rvergara59@kprotonmail.com>
RUN apt update RUN apt update
@ -7,15 +9,8 @@ RUN apt update
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
# Update the package list and install necessary packages # Update the package list and install necessary packages
RUN apt-get install -y \ RUN apt-get install -qqy xterm x11-apps
xfce4 \
xfce4-goodies \
tigervnc-standalone-server \
dbus-x11 \
xfonts-base \
xterm \
wget
RUN apt-get install -y \ RUN apt-get install -y \
libxss-dev \ libxss-dev \
libxrandr-dev \ libxrandr-dev \
@ -27,25 +22,9 @@ RUN apt-get install -y \
RUN apt-get clean \ RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create a new user (e.g., "zenusr") and set a password # Create a new user (e.g., "zenusr") and set a password
RUN useradd -ms /bin/bash zenusr RUN useradd -ms /bin/bash zenusr
RUN echo "1234\n1234\n" | passwd 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 RUN mkdir /home/zenusr/assets
COPY assets/* /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_adm /root/.bashrc
COPY bash_rc_usr /home/zenusr/.bashrc COPY bash_rc_usr /home/zenusr/.bashrc
COPY zenith /usr/local/bin COPY zenith /usr/local/bin
COPY startzen /usr/local/bin
COPY librustzcash_wrapper.so /usr/local/lib COPY librustzcash_wrapper.so /usr/local/lib
COPY sapling-spend.params /usr/local/lib COPY sapling-spend.params /usr/local/lib
COPY sapling-output.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 chmod +x /usr/local/bin/updlibc
RUN updlibc RUN updlibc
RUN echo '#!/bin/bash\nvncserver -geometry 1360x768 -depth 24 -SendCutText' > /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 #RUN chmod +x /usr/local/bin/startvnc
# Set the user to "zenusr" # Set the user to "zenusr"
#USER zenusr USER zenusr
WORKDIR /home/zenusr WORKDIR /home/zenusr
ENV USER=zenusr ENV USER=zenusr
CMD ["startzen"]
CMD ["/bin/bash"]

View file

@ -1,69 +0,0 @@
FROM ubuntu:22.04
MAINTAINER Rene V. Vergara A. <rvergara59@kprotonmail.com>
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"]

View file

@ -1,6 +1,17 @@
#!/bin/bash #!/bin/bash
ZFOLDER=~/Zenith 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 # Check if data folder exists
if [ ! -d "$ZFOLDER" ]; then if [ ! -d "$ZFOLDER" ]; then
@ -18,7 +29,6 @@ if [[ "$(docker images -q $IMAGE_NAME 2> /dev/null)" == "" ]]; then
exit exit
fi 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

6
docker_files/startzen Executable file
View file

@ -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