From 9de99648e323ea0732f94b783a60c5d11c4beed7 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Mon, 17 Sep 2018 16:30:21 +1000 Subject: [PATCH 1/3] Dockerfile does not conform to entrypoint best practice #8 --- Dockerfile | 7 +++++-- docker-entrypoint.sh | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index a22123a..31842ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,15 @@ FROM alpine LABEL maintainer Bill Wang -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"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..a5a6767 --- /dev/null +++ b/docker-entrypoint.sh @@ -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 From 446a8e9988d07661f8c867ff3d9222ac22bb57e0 Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Mon, 17 Sep 2018 16:58:20 +1000 Subject: [PATCH 2/3] Dockerfile does not conform to entrypoint best practice #8 --- .travis.yml | 1 + Makefile | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 .travis.yml create mode 100644 Makefile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d4af309 --- /dev/null +++ b/.travis.yml @@ -0,0 +1 @@ +script: make diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..53e2276 --- /dev/null +++ b/Makefile @@ -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 From 584d1e30f39ee7a04140f4bff16895b0035d5eaf Mon Sep 17 00:00:00 2001 From: Bill Wang Date: Mon, 17 Sep 2018 22:05:50 +1000 Subject: [PATCH 3/3] Dockerfile does not conform to entrypoint best practice #8 --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index d4af309..e7cd918 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1 +1,6 @@ +sudo: required + +services: + - docker + script: make