Loading Dockerfile +14 −13 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ RUN apt-get update \ tini \ wget \ ovmf \ socat \ nginx \ swtpm \ procps \ Loading @@ -29,12 +28,14 @@ RUN apt-get update \ && tar -xf /tmp/novnc.tar.gz -C /tmp/ \ && cd /tmp/noVNC-"$novnc" \ && mv app core vendor package.json *.html /usr/share/novnc \ && sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* COPY ./src /run/ COPY nginx.conf /etc/nginx/sites-enabled/novnc.conf COPY ./web /var/www/ RUN chmod +x /run/*.sh RUN mv /var/www/nginx.conf /etc/nginx/sites-enabled/web.conf VOLUME /storage EXPOSE 22 5900 8006 Loading src/config.sh +10 −0 Original line number Diff line number Diff line Loading @@ -15,4 +15,14 @@ DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0 ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $DISPLAY_OPTS $MON_OPTS $SERIAL_OPTS $NET_OPTS $DISK_OPTS $BOOT_OPTS $DEV_OPTS $USB_OPTS $ARGUMENTS" ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') if [[ "${DISPLAY,,}" == "web" ]]; then rm -f /dev/shm/index.html else if [[ "${DISPLAY,,}" == "vnc" ]]; then html "You can now connect to VNC on port 5900." "0" else html "The virtual machine was booted successfully." "0" fi fi return 0 src/disk.sh +13 −4 Original line number Diff line number Diff line Loading @@ -116,7 +116,9 @@ createDisk() { fi fi info "Creating a $DISK_TYPE $DISK_DESC image in $DISK_FMT format with a size of $DISK_SPACE..." MSG="Creating a $DISK_TYPE $DISK_DESC image in $DISK_FMT format with a size of $DISK_SPACE..." info "$MSG" && html "$MSG" local FAIL="Could not create a $DISK_TYPE $DISK_FMT $DISK_DESC image of $DISK_SPACE ($DISK_FILE)" case "${DISK_FMT,,}" in Loading Loading @@ -199,7 +201,9 @@ resizeDisk() { fi local GB=$(( (CUR_SIZE + 1073741823)/1073741824 )) info "Resizing $DISK_DESC from ${GB}G to $DISK_SPACE..." MSG="Resizing $DISK_DESC from ${GB}G to $DISK_SPACE..." info "$MSG" && html "$MSG" local FAIL="Could not resize the $DISK_TYPE $DISK_FMT $DISK_DESC image from ${GB}G to $DISK_SPACE ($DISK_FILE)" case "${DISK_FMT,,}" in Loading Loading @@ -266,7 +270,8 @@ convertDisk() { fi fi info "Converting $DISK_DESC to $DST_FMT, please wait until completed..." MSG="Converting $DISK_DESC to $DST_FMT, please wait until completed..." info "$MSG" && html "$MSG" local CONV_FLAGS="-p" local DISK_PARAM="$DISK_ALLOC" Loading Loading @@ -305,7 +310,8 @@ convertDisk() { fi fi info "Conversion of $DISK_DESC to $DST_FMT completed succesfully!" MSG="Conversion of $DISK_DESC to $DST_FMT completed succesfully!" info "$MSG" && html "$MSG" return 0 } Loading Loading @@ -420,6 +426,8 @@ addDevice () { return 0 } html "Initializing disks..." DISK1_FILE="$STORAGE/data" DISK2_FILE="/storage2/data2" DISK3_FILE="/storage3/data3" Loading Loading @@ -484,4 +492,5 @@ else addDisk "userdata4" "$DISK4_FILE" "$DISK_EXT" "disk4" "$DISK4_SIZE" "4" "0xd" "$DISK_FMT" || exit $? fi html "Initialized disks successfully..." return 0 src/entry.sh +2 −7 Original line number Diff line number Diff line #!/usr/bin/env bash set -Eeuo pipefail echo "❯ Starting QEMU for Docker v$(</run/version)..." echo "❯ For support visit https://github.com/qemus/qemu-docker" echo APP="QEMU" SUPPORT="https://github.com/qemus/qemu-docker" cd /run Loading @@ -18,10 +17,6 @@ cd /run trap - ERR if [[ "${DISPLAY,,}" == "web" ]]; then nginx -e stderr fi info "Booting image using $VERS..." [[ "$DEBUG" == [Yy1]* ]] && set -x Loading src/install.sh +3 −5 Original line number Diff line number Diff line #!/usr/bin/env bash set -Eeuo pipefail # Display wait message MSG="Please wait while the ISO is being downloaded..." /run/server.sh "QEMU" "$MSG" & # Check if running with interactive TTY or redirected to docker log if [ -t 1 ]; then PROGRESS="--progress=bar:noscroll" Loading @@ -30,7 +26,8 @@ BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g') TMP="$STORAGE/${BASE%.*}.tmp" rm -f "$TMP" info "Downloading $BASE as boot image..." MSG="Downloading $BASE as boot image..." info "$MSG" && html "$MSG" { wget "$BOOT" -O "$TMP" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : Loading @@ -45,4 +42,5 @@ fi mv -f "$TMP" "$STORAGE/$BASE" html "Download finished successfully..." return 0 Loading
Dockerfile +14 −13 Original line number Diff line number Diff line Loading @@ -9,7 +9,6 @@ RUN apt-get update \ tini \ wget \ ovmf \ socat \ nginx \ swtpm \ procps \ Loading @@ -29,12 +28,14 @@ RUN apt-get update \ && tar -xf /tmp/novnc.tar.gz -C /tmp/ \ && cd /tmp/noVNC-"$novnc" \ && mv app core vendor package.json *.html /usr/share/novnc \ && sed -i 's/^worker_processes.*/worker_processes 1;/' /etc/nginx/nginx.conf \ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* COPY ./src /run/ COPY nginx.conf /etc/nginx/sites-enabled/novnc.conf COPY ./web /var/www/ RUN chmod +x /run/*.sh RUN mv /var/www/nginx.conf /etc/nginx/sites-enabled/web.conf VOLUME /storage EXPOSE 22 5900 8006 Loading
src/config.sh +10 −0 Original line number Diff line number Diff line Loading @@ -15,4 +15,14 @@ DEV_OPTS="$DEV_OPTS -device virtio-rng-pci,rng=objrng0,id=rng0,bus=pcie.0,addr=0 ARGS="$DEF_OPTS $CPU_OPTS $RAM_OPTS $MAC_OPTS $DISPLAY_OPTS $MON_OPTS $SERIAL_OPTS $NET_OPTS $DISK_OPTS $BOOT_OPTS $DEV_OPTS $USB_OPTS $ARGUMENTS" ARGS=$(echo "$ARGS" | sed 's/\t/ /g' | tr -s ' ') if [[ "${DISPLAY,,}" == "web" ]]; then rm -f /dev/shm/index.html else if [[ "${DISPLAY,,}" == "vnc" ]]; then html "You can now connect to VNC on port 5900." "0" else html "The virtual machine was booted successfully." "0" fi fi return 0
src/disk.sh +13 −4 Original line number Diff line number Diff line Loading @@ -116,7 +116,9 @@ createDisk() { fi fi info "Creating a $DISK_TYPE $DISK_DESC image in $DISK_FMT format with a size of $DISK_SPACE..." MSG="Creating a $DISK_TYPE $DISK_DESC image in $DISK_FMT format with a size of $DISK_SPACE..." info "$MSG" && html "$MSG" local FAIL="Could not create a $DISK_TYPE $DISK_FMT $DISK_DESC image of $DISK_SPACE ($DISK_FILE)" case "${DISK_FMT,,}" in Loading Loading @@ -199,7 +201,9 @@ resizeDisk() { fi local GB=$(( (CUR_SIZE + 1073741823)/1073741824 )) info "Resizing $DISK_DESC from ${GB}G to $DISK_SPACE..." MSG="Resizing $DISK_DESC from ${GB}G to $DISK_SPACE..." info "$MSG" && html "$MSG" local FAIL="Could not resize the $DISK_TYPE $DISK_FMT $DISK_DESC image from ${GB}G to $DISK_SPACE ($DISK_FILE)" case "${DISK_FMT,,}" in Loading Loading @@ -266,7 +270,8 @@ convertDisk() { fi fi info "Converting $DISK_DESC to $DST_FMT, please wait until completed..." MSG="Converting $DISK_DESC to $DST_FMT, please wait until completed..." info "$MSG" && html "$MSG" local CONV_FLAGS="-p" local DISK_PARAM="$DISK_ALLOC" Loading Loading @@ -305,7 +310,8 @@ convertDisk() { fi fi info "Conversion of $DISK_DESC to $DST_FMT completed succesfully!" MSG="Conversion of $DISK_DESC to $DST_FMT completed succesfully!" info "$MSG" && html "$MSG" return 0 } Loading Loading @@ -420,6 +426,8 @@ addDevice () { return 0 } html "Initializing disks..." DISK1_FILE="$STORAGE/data" DISK2_FILE="/storage2/data2" DISK3_FILE="/storage3/data3" Loading Loading @@ -484,4 +492,5 @@ else addDisk "userdata4" "$DISK4_FILE" "$DISK_EXT" "disk4" "$DISK4_SIZE" "4" "0xd" "$DISK_FMT" || exit $? fi html "Initialized disks successfully..." return 0
src/entry.sh +2 −7 Original line number Diff line number Diff line #!/usr/bin/env bash set -Eeuo pipefail echo "❯ Starting QEMU for Docker v$(</run/version)..." echo "❯ For support visit https://github.com/qemus/qemu-docker" echo APP="QEMU" SUPPORT="https://github.com/qemus/qemu-docker" cd /run Loading @@ -18,10 +17,6 @@ cd /run trap - ERR if [[ "${DISPLAY,,}" == "web" ]]; then nginx -e stderr fi info "Booting image using $VERS..." [[ "$DEBUG" == [Yy1]* ]] && set -x Loading
src/install.sh +3 −5 Original line number Diff line number Diff line #!/usr/bin/env bash set -Eeuo pipefail # Display wait message MSG="Please wait while the ISO is being downloaded..." /run/server.sh "QEMU" "$MSG" & # Check if running with interactive TTY or redirected to docker log if [ -t 1 ]; then PROGRESS="--progress=bar:noscroll" Loading @@ -30,7 +26,8 @@ BASE=$(echo "$BASE" | sed -e 's/[^A-Za-z0-9._-]/_/g') TMP="$STORAGE/${BASE%.*}.tmp" rm -f "$TMP" info "Downloading $BASE as boot image..." MSG="Downloading $BASE as boot image..." info "$MSG" && html "$MSG" { wget "$BOOT" -O "$TMP" -q --no-check-certificate --show-progress "$PROGRESS"; rc=$?; } || : Loading @@ -45,4 +42,5 @@ fi mv -f "$TMP" "$STORAGE/$BASE" html "Download finished successfully..." return 0