Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
script: make
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ FROM alpine

LABEL maintainer Bill Wang <ozbillwang@gmail.com>

RUN apk --update add git openssh && \
RUN apk --update add git openssh bash && \
rm -rf /var/lib/apt/lists/* && \
rm /var/cache/apk/*

COPY docker-entrypoint.sh /bin/docker-entrypoint.sh
RUN chmod +x /bin/docker-entrypoint.sh

VOLUME /git
WORKDIR /git

ENTRYPOINT ["git"]
ENTRYPOINT ["/bin/docker-entrypoint.sh"]
CMD ["--help"]
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
RELEASE_TYPE ?= patch
SEMVER_IMAGE ?= alpine/semver

CURRENT_VERSION := $(shell git tag -l -n [0-9]* | sort --version-sort -r | awk 'NR==1{print $$1}' )

ifndef CURRENT_VERSION
CURRENT_VERSION := 0.0.0
endif

NEXT_VERSION := $(shell docker run --rm $(SEMVER_IMAGE) semver -c -i $(RELEASE_TYPE) $(CURRENT_VERSION))

BRANCH = $(shell git rev-parse --abbrev-ref HEAD)

.PHONY: all current-version next-version release
all: release

current-version:
@echo $(CURRENT_VERSION)

next-version:
@echo $(NEXT_VERSION)

release:
if [ "$(BRANCH)" = "master" ];then \
git tag $(NEXT_VERSION) ;\
git push --tags ;\
fi
15 changes: 15 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

# A beginning user should be able to docker run image bash (or sh) without
# needing to learn about --entrypoint
# https://github.com/docker-library/official-images#consistency

set -e

# allow to run "sh" or "bash"
if [ "$1" = 'sh' ] || [ "$1" = 'bash' ]; then
exec "$@"
else
# else default to run command with git
exec git "$@"
fi