Skip to content

Commit

Permalink
Add visioning similar to dockwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
austinwbest committed Nov 13, 2024
1 parent 0b89ccb commit 99538c9
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
44 changes: 44 additions & 0 deletions root/app/www/public/functions/git.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*
----------------------------------
------ Created: 111224 ------
------ Austin Best ------
----------------------------------
*/

function gitBranch()
{
if (!defined('DOCKERFILE_BRANCH')) {
return 'Source';
}

return DOCKERFILE_BRANCH;
}

function gitHash()
{
if (!defined('DOCKERFILE_COMMIT')) {
return 'Unknown';
}

return DOCKERFILE_COMMIT;
}

function gitMessage()
{
if (!defined('DOCKERFILE_COMMIT_MSG')) {
return 'Unknown';
}

return DOCKERFILE_COMMIT_MSG;
}

function gitVersion()
{
if (!defined('DOCKERFILE_COMMITS')) {
return '<span class="text-small text-secondary" title="Branch: ' . gitBranch() . ' - Commit: ' . gitHash() . '">v0.0.0</span>';
}

return '<span class="text-small text-secondary" title="Branch: ' . gitBranch() . ' - Commit: ' . gitHash() . '">v' . APP_X . '.' . APP_Y . '.' . DOCKERFILE_COMMITS . '</span>';
}
2 changes: 2 additions & 0 deletions root/app/www/public/includes/constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion root/app/www/public/includes/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
<body>
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
<div class="container-fluid">
<a class="navbar-brand" href="?page=home"><img src="images/logo-32.png"> <?= APP_NAME ?></a>
<a class="navbar-brand" href="?page=home">
<img src="images/logo-32.png"> <?= APP_NAME ?>
<?= gitVersion() ?>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
Expand Down

0 comments on commit 99538c9

Please sign in to comment.