From 77545858544b9baaf9149c0f9ea798413e85494d Mon Sep 17 00:00:00 2001 From: ElevenNotes Date: Mon, 17 Feb 2025 10:57:55 +0100 Subject: [PATCH] add KMS_GUI_STYLE --- README.md | 2 ++ RELEASE.md | 3 ++- arch.dockerfile | 24 ++++++++++++++++++++++-- rootfs/usr/local/bin/entrypoint.sh | 14 ++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index af795bd..a4ce9a1 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ volumes: | --- | --- | --- | | `TZ` | [Time Zone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) | | | `DEBUG` | Will activate debug option for container image and app (if available) | | +| `KMS_GUI_STYLE` | switch the UI style of the webinterface (py-kms, custom-icon) | custom-icon | # SOURCE 💾 * [11notes/kms-gui](https://github.com/11notes/docker-kms-gui) @@ -63,6 +64,7 @@ volumes: # BUILT WITH 🧰 * [py-kms](https://github.com/Py-KMS-Organization/py-kms) +* [CustomIcon/pykms-frontend](https://github.com/CustomIcon/pykms-frontend) * [alpine](https://alpinelinux.org) # GENERAL TIPS 📌 diff --git a/RELEASE.md b/RELEASE.md index 95d414c..6423f4d 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,2 +1,3 @@ ### 🪄 Features -* new .json format \ No newline at end of file +* new KMS_GUI_STYLE variable to switch the style of the UI +* added custom GUI of @CustomIcon as default (thanks!) \ No newline at end of file diff --git a/arch.dockerfile b/arch.dockerfile index 1b20273..8ddc711 100644 --- a/arch.dockerfile +++ b/arch.dockerfile @@ -2,6 +2,13 @@ ARG APP_VERSION=stable ARG APP_VERSION_PREFIX="" ARG APP_VERSION_SUFFIX="" +# :: Build / templates + FROM alpine/git AS templates + RUN set -ex; \ + git clone https://github.com/CustomIcon/pykms-frontend.git; \ + cd /git/pykms-frontend; \ + git reset --hard 9e789a5; + # :: Header FROM 11notes/kms:${APP_VERSION_PREFIX}${APP_VERSION}${APP_VERSION_SUFFIX} @@ -20,6 +27,8 @@ ARG APP_VERSION_SUFFIX="" ENV APP_VERSION=${APP_VERSION} ENV APP_ROOT=${APP_ROOT} + ENV KMS_GUI_STYLE="custom-icon" + ENV PYKMS_SQLITE_DB_PATH=/kms/var/kms.db ENV PYKMS_LICENSE_PATH=/opt/py-kms/LICENSE ENV PYKMS_VERSION_PATH=/opt/py-kms/VERSION @@ -46,8 +55,19 @@ ARG APP_VERSION_SUFFIX="" pip3 install --no-cache-dir -r /opt/py-kms/requirements.gui.txt --break-system-packages; \ apk del --no-network .build; - # :: copy filesystem changes and set correct permissions - COPY ./rootfs / + # :: copy filesystem changes + COPY ./rootfs / + + # :: add multi template option + RUN set -ex; \ + mkdir -p ${APP_ROOT}/.default/templates/py-kms; \ + mkdir -p ${APP_ROOT}/.default/templates/custom-icon; \ + cp -R /opt/py-kms/templates/* ${APP_ROOT}/.default/templates/py-kms; \ + rm -rf /opt/py-kms/templates; + + COPY --from=templates /git/pykms-frontend/templates/ ${APP_ROOT}/.default/templates/custom-icon + + # :: set correct permissions RUN set -ex; \ chmod +x -R /usr/local/bin; \ chown -R ${APP_UID}:${APP_GID} \ diff --git a/rootfs/usr/local/bin/entrypoint.sh b/rootfs/usr/local/bin/entrypoint.sh index 833ff47..62dae0c 100644 --- a/rootfs/usr/local/bin/entrypoint.sh +++ b/rootfs/usr/local/bin/entrypoint.sh @@ -6,6 +6,20 @@ eleven log debug "setting kms-gui log level to DEBUG" fi + # apply correct style + rm -rf /opt/py-kms/templates + TEMPLATE_DIR=${APP_ROOT}/.default/templates + case ${KMS_GUI_STYLE} in + py-kms) + ln -s ${TEMPLATE_DIR}/py-kms /opt/py-kms/templates + eleven log info "using ${KMS_GUI_STYLE} GUI style" + ;; + *) + ln -s ${TEMPLATE_DIR}/custom-icon /opt/py-kms/templates + eleven log info "using default GUI style" + ;; + esac + cd /opt/py-kms set -- "gunicorn" \ --log-level ${LOG_LEVEL} \