From 99538c97094cbfc615f8a4e931233f9ed720cd9f Mon Sep 17 00:00:00 2001 From: Austin Best Date: Tue, 12 Nov 2024 23:26:29 -0500 Subject: [PATCH] Add visioning similar to dockwatch --- .github/workflows/docker-publish.yml | 5 +++ Dockerfile | 10 +++++ root/app/www/public/functions/git.php | 44 ++++++++++++++++++++++ root/app/www/public/includes/constants.php | 2 + root/app/www/public/includes/header.php | 5 ++- 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 root/app/www/public/functions/git.php diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index fc747fe..4b42365 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -79,3 +79,8 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + "BUILD_DATE=${{ env.BUILD_DATE }}" + "COMMITS=${{ env.COMMITS }}" + "BRANCH=${{ github.ref_name }}" + "COMMIT=${{ github.sha }}" diff --git a/Dockerfile b/Dockerfile index 5f7f7f2..d6cc6d6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,16 @@ HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --start-interval=10 # add local files COPY root/ / +ARG COMMIT=unknown +ARG COMMITS=0 +ARG BRANCH=unknown +ARG COMMIT_MSG=unknown +RUN echo -e "\n//-- DOCKERFILE DEFINES" >> /app/www/public/includes/constants.php \ + && echo "define('DOCKERFILE_BUILD_DATE', '${BUILD_DATE}');" >> /app/www/public/includes/constants.php \ + && echo "define('DOCKERFILE_COMMIT', '${COMMIT}');" >> /app/www/public/includes/constants.php \ + && echo "define('DOCKERFILE_COMMITS', '${COMMITS}');" >> /app/www/public/includes/constants.php \ + && echo "define('DOCKERFILE_BRANCH', '${BRANCH}');" >> /app/www/public/includes/constants.php + # ports and volumes EXPOSE 80 443 diff --git a/root/app/www/public/functions/git.php b/root/app/www/public/functions/git.php new file mode 100644 index 0000000..24f958d --- /dev/null +++ b/root/app/www/public/functions/git.php @@ -0,0 +1,44 @@ +v0.0.0'; + } + + return 'v' . APP_X . '.' . APP_Y . '.' . DOCKERFILE_COMMITS . ''; +} diff --git a/root/app/www/public/includes/constants.php b/root/app/www/public/includes/constants.php index c0e18ac..f223fa5 100644 --- a/root/app/www/public/includes/constants.php +++ b/root/app/www/public/includes/constants.php @@ -10,6 +10,8 @@ define('APP_NAME', 'Starr Proxy'); define('APP_API_ERROR', APP_NAME .': %s'); define('APP_URL', ($_SERVER['REQUEST_SCHEME'] ?: 'http') . '://'. $_SERVER['HTTP_HOST']); +define('APP_X', 0); +define('APP_Y', 1); define('STARR_BACKUP_AGE', 2); //-- DELETE AFTER THIS AMOUNT OF DAYS diff --git a/root/app/www/public/includes/header.php b/root/app/www/public/includes/header.php index aefe10c..d3863fb 100644 --- a/root/app/www/public/includes/header.php +++ b/root/app/www/public/includes/header.php @@ -48,7 +48,10 @@