From 552811024c3ab3d054775277c436c340f6064c89 Mon Sep 17 00:00:00 2001 From: Sheng Yang Date: Thu, 13 Apr 2017 12:14:41 -0700 Subject: [PATCH] package: docker image now includes actual version Also fix several typos --- Makefile | 3 ++- README.md | 4 ++-- package.json | 2 +- scripts/version | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 scripts/version diff --git a/Makefile b/Makefile index 263154e2..52f71272 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NS = rancher -VERSION ?= latest +VERSION = $(shell ./scripts/version) REPO = longhorn-ui NAME = longhorn-ui @@ -11,6 +11,7 @@ PORT = 8000 build: docker build -t $(NS)/$(REPO):$(VERSION) . + @echo Build $(NS)/$(REPO):$(VERSION) successful stop: docker stop $(NAME)-$(INSTANCE) diff --git a/README.md b/README.md index c374ee6c..87f71194 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ Prerequisites: Setup: ```bash - git clone 'https://github.com/rancher/longhron-ui' - cd 'longhron-ui' + git clone 'https://github.com/rancher/longhorn-ui' + cd 'longhorn-ui' npm install ``` Run development server pointed at some Longhron Manger API diff --git a/package.json b/package.json index bb41429a..6444bbef 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "longhron", + "name": "longhorn", "version": "0.0.1", "private": true, "scripts": { diff --git a/scripts/version b/scripts/version new file mode 100755 index 00000000..eaf8c942 --- /dev/null +++ b/scripts/version @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +if [ -n "$(git status --porcelain --untracked-files=no)" ]; then + DIRTY="-dirty" +fi + +COMMIT=$(git rev-parse --short HEAD) +GIT_TAG=$(git tag -l --contains HEAD | head -n 1) + +if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then + VER=$GIT_TAG +else + VER="${COMMIT}${DIRTY}" +fi + +echo ${VER}