Skip to content

Commit 99538c9

Browse files
committed
Add visioning similar to dockwatch
1 parent 0b89ccb commit 99538c9

File tree

5 files changed

+65
-1
lines changed

5 files changed

+65
-1
lines changed

.github/workflows/docker-publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,8 @@ jobs:
7979
labels: ${{ steps.meta.outputs.labels }}
8080
cache-from: type=gha
8181
cache-to: type=gha,mode=max
82+
build-args: |
83+
"BUILD_DATE=${{ env.BUILD_DATE }}"
84+
"COMMITS=${{ env.COMMITS }}"
85+
"BRANCH=${{ github.ref_name }}"
86+
"COMMIT=${{ github.sha }}"

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --start-interval=10
2525
# add local files
2626
COPY root/ /
2727

28+
ARG COMMIT=unknown
29+
ARG COMMITS=0
30+
ARG BRANCH=unknown
31+
ARG COMMIT_MSG=unknown
32+
RUN echo -e "\n//-- DOCKERFILE DEFINES" >> /app/www/public/includes/constants.php \
33+
&& echo "define('DOCKERFILE_BUILD_DATE', '${BUILD_DATE}');" >> /app/www/public/includes/constants.php \
34+
&& echo "define('DOCKERFILE_COMMIT', '${COMMIT}');" >> /app/www/public/includes/constants.php \
35+
&& echo "define('DOCKERFILE_COMMITS', '${COMMITS}');" >> /app/www/public/includes/constants.php \
36+
&& echo "define('DOCKERFILE_BRANCH', '${BRANCH}');" >> /app/www/public/includes/constants.php
37+
2838
# ports and volumes
2939
EXPOSE 80 443
3040

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
/*
4+
----------------------------------
5+
------ Created: 111224 ------
6+
------ Austin Best ------
7+
----------------------------------
8+
*/
9+
10+
function gitBranch()
11+
{
12+
if (!defined('DOCKERFILE_BRANCH')) {
13+
return 'Source';
14+
}
15+
16+
return DOCKERFILE_BRANCH;
17+
}
18+
19+
function gitHash()
20+
{
21+
if (!defined('DOCKERFILE_COMMIT')) {
22+
return 'Unknown';
23+
}
24+
25+
return DOCKERFILE_COMMIT;
26+
}
27+
28+
function gitMessage()
29+
{
30+
if (!defined('DOCKERFILE_COMMIT_MSG')) {
31+
return 'Unknown';
32+
}
33+
34+
return DOCKERFILE_COMMIT_MSG;
35+
}
36+
37+
function gitVersion()
38+
{
39+
if (!defined('DOCKERFILE_COMMITS')) {
40+
return '<span class="text-small text-secondary" title="Branch: ' . gitBranch() . ' - Commit: ' . gitHash() . '">v0.0.0</span>';
41+
}
42+
43+
return '<span class="text-small text-secondary" title="Branch: ' . gitBranch() . ' - Commit: ' . gitHash() . '">v' . APP_X . '.' . APP_Y . '.' . DOCKERFILE_COMMITS . '</span>';
44+
}

root/app/www/public/includes/constants.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
define('APP_NAME', 'Starr Proxy');
1111
define('APP_API_ERROR', APP_NAME .': %s');
1212
define('APP_URL', ($_SERVER['REQUEST_SCHEME'] ?: 'http') . '://'. $_SERVER['HTTP_HOST']);
13+
define('APP_X', 0);
14+
define('APP_Y', 1);
1315

1416
define('STARR_BACKUP_AGE', 2); //-- DELETE AFTER THIS AMOUNT OF DAYS
1517

root/app/www/public/includes/header.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
<body>
4949
<nav class="navbar navbar-expand-lg bg-dark" data-bs-theme="dark">
5050
<div class="container-fluid">
51-
<a class="navbar-brand" href="?page=home"><img src="images/logo-32.png"> <?= APP_NAME ?></a>
51+
<a class="navbar-brand" href="?page=home">
52+
<img src="images/logo-32.png"> <?= APP_NAME ?>
53+
<?= gitVersion() ?>
54+
</a>
5255
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
5356
<span class="navbar-toggler-icon"></span>
5457
</button>

0 commit comments

Comments
 (0)