mirror of
https://github.com/kwk/docker-registry-frontend.git
synced 2024-09-20 07:16:23 +08:00
Added version information to bottom of screen
At the bottom of the screen the docker-registry-frontend will now render the commit upon the running version is built. The commit is linked to the github commit page.
This commit is contained in:
parent
6c05b4ff7f
commit
0861441c37
|
@ -1,4 +1,3 @@
|
|||
.git
|
||||
node_modules
|
||||
dist
|
||||
.tmp
|
||||
|
|
14
Dockerfile
14
Dockerfile
|
@ -12,6 +12,8 @@ ENV WWW_DIR /var/www/html
|
|||
ENV SOURCE_DIR /tmp/source
|
||||
ENV START_SCRIPT /root/start-apache.sh
|
||||
|
||||
RUN mkdir -pv $WWW_DIR
|
||||
|
||||
############################################################
|
||||
# Speedup DPKG and don't use cache for packages
|
||||
############################################################
|
||||
|
@ -68,6 +70,17 @@ ADD LICENSE $SOURCE_DIR/
|
|||
ADD package.json $SOURCE_DIR/
|
||||
ADD README.md $SOURCE_DIR/
|
||||
|
||||
# Add Git version information to it's own json file app-version.json
|
||||
RUN mkdir -p $SOURCE_DIR/.git
|
||||
ADD .git/HEAD $SOURCE_DIR/.git/HEAD
|
||||
ADD .git/refs $SOURCE_DIR/.git/refs
|
||||
RUN cd $SOURCE_DIR && \
|
||||
export GITREF=$(cat .git/HEAD | cut -d" " -f2) && \
|
||||
export GITSHA1=$(cat .git/$GITREF) && \
|
||||
echo "{\"git\": {\"sha1\": \"$GITSHA1\", \"ref\": \"$GITREF\"}}" > $WWW_DIR/app-version.json && \
|
||||
cd $SOURCE_DIR && \
|
||||
rm -rf $SOURCE_DIR/.git
|
||||
|
||||
############################################################
|
||||
# This is written so compact, to reduce the size of the
|
||||
# final container and its layers. We have to install build
|
||||
|
@ -78,7 +91,6 @@ ADD README.md $SOURCE_DIR/
|
|||
# installed app artifacts.
|
||||
############################################################
|
||||
|
||||
RUN mkdir -pv $WWW_DIR
|
||||
RUN apt-get -y install \
|
||||
git \
|
||||
nodejs \
|
||||
|
|
1
app/app-version.json
Normal file
1
app/app-version.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"git": {"sha1": "foo", "ref": "bar"}}
|
|
@ -1,6 +1,6 @@
|
|||
<!doctype html>
|
||||
<html class="no-js" ng-app="docker-registry-frontend">
|
||||
<head ng-controller="MainController as main">
|
||||
<html class="no-js" ng-app="docker-registry-frontend" ng-controller="MainController as main">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title ng-bind-template="Docker registry {{main.$location.path()}}">Docker registry</title>
|
||||
<meta name="description" content="">
|
||||
|
@ -37,6 +37,7 @@
|
|||
<p class="text-muted"><a href="#/about">About the Docker Registry Frontend</a></p>
|
||||
<p><span class="glyphicon glyphicon-fire"></span> <a href="https://github.com/kwk/docker-registry-frontend/issues/new">Report a bug</a></p>
|
||||
<p><span class="glyphicon glyphicon-random"></span> <a href="https://github.com/kwk/docker-registry-frontend">Fork me on GitHub</a></p>
|
||||
<p class="text-muted"><small>This is git revision: <a href="https://github.com/kwk/docker-registry-frontend/commit/{{appVersion.git.sha1}}"><span ng-bind-template="{{appVersion.git.sha1 | limitTo: 7}}">-</span></a></small></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -82,6 +83,7 @@
|
|||
<script src="scripts/directives/tag-list-directive.js"></script>
|
||||
<script src="scripts/directives/image-details-directive.js"></script>
|
||||
<script src="scripts/services/registry-services.js"></script>
|
||||
<script src="scripts/services/app-version-services.js"></script>
|
||||
<!-- endbuild -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -32,6 +32,7 @@ angular
|
|||
'ui.bootstrap',
|
||||
'angular-loading-bar',
|
||||
'angularMoment',
|
||||
'app-version-services',
|
||||
])
|
||||
.config(['$routeProvider', '$resourceProvider', 'cfpLoadingBarProvider', function($routeProvider, $resourceProvider, cfpLoadingBarProvider){
|
||||
|
||||
|
|
|
@ -8,9 +8,10 @@
|
|||
* Controller of the docker-registry-frontend
|
||||
*/
|
||||
angular.module('main-controller', [])
|
||||
.controller('MainController', ['$scope', '$route', '$routeParams', '$location',
|
||||
function($scope, $route, $routeParams, $location){
|
||||
.controller('MainController', ['$scope', '$route', '$routeParams', '$location', 'AppVersion',
|
||||
function($scope, $route, $routeParams, $location, AppVersion){
|
||||
this.$route = $route;
|
||||
this.$location = $location;
|
||||
this.$routeParams = $routeParams;
|
||||
$scope.appVersion = AppVersion.query();
|
||||
}]);
|
14
app/scripts/services/app-version-services.js
Normal file
14
app/scripts/services/app-version-services.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
// This allows the application to query information about its version.
|
||||
// The "app-version.json" file will be build during "docker build".
|
||||
|
||||
angular.module('app-version-services', ['ngResource'])
|
||||
.factory('AppVersion', ['$resource', '$log', function($resource, $log){
|
||||
return $resource('/app-version.json', {}, {
|
||||
'query': {
|
||||
method:'GET',
|
||||
isArray: false,
|
||||
},
|
||||
});
|
||||
}]);
|
Loading…
Reference in a new issue