Files
docker-kms-gui/arch.dockerfile
2025-02-17 10:57:55 +01:00

81 lines
2.1 KiB
Docker

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}
# :: arguments
ARG TARGETARCH
ARG APP_IMAGE
ARG APP_NAME
ARG APP_VERSION
ARG APP_ROOT
ARG APP_UID
ARG APP_GID
# :: environment
ENV APP_IMAGE=${APP_IMAGE}
ENV APP_NAME=${APP_NAME}
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
ENV PORT=8080
ENV LOG_LEVEL=INFO
# :: multi-stage
COPY ./LICENSE /opt/py-kms
# :: Run
USER root
RUN eleven printenv;
# :: install application
RUN set -ex; \
apk --no-cache --update --virtual .build add \
py3-pip;
RUN set -ex; \
mkdir -p ${APP_ROOT}/var; \
cd /opt/py-kms; \
echo "${APP_VERSION}" > VERSION; \
echo "master" >> VERSION; \
pip3 install --no-cache-dir -r /opt/py-kms/requirements.gui.txt --break-system-packages; \
apk del --no-network .build;
# :: 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} \
${APP_ROOT} \
/opt/py-kms;
# :: Monitor
HEALTHCHECK --interval=5s --timeout=2s CMD curl -X GET -kILs --fail http://localhost:${PORT}/livez || exit 1
# :: Start
USER docker