From 4bc05a593541822f07a5279987a6ed95f0516931 Mon Sep 17 00:00:00 2001 From: Linus Lotz Date: Fri, 7 Dec 2018 13:04:59 +0100 Subject: [PATCH 1/2] Add explicit docker-entrypoint to comply with official image rules --- Dockerfile | 4 +++- docker-entrypoint.sh | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 docker-entrypoint.sh diff --git a/Dockerfile b/Dockerfile index f9cac29..e7519b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM alpine LABEL maintainer Bill Wang +COPY docker-entrypoint.sh /docker-entrypoint.sh + RUN apk --update add git less openssh && \ rm -rf /var/lib/apt/lists/* && \ rm /var/cache/apk/* @@ -9,5 +11,5 @@ RUN apk --update add git less openssh && \ VOLUME /git WORKDIR /git -ENTRYPOINT ["git"] +ENTRYPOINT ["/docker-entrypoint.sh"] CMD ["--help"] diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100755 index 0000000..d8a51e1 --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/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 + +# run command if it is not starting with a "-", is not a git subcommand and is an executable in PATH +if [ "${#}" -gt "0" ] && \ + [ "${1#-}" == "${1}" ] && \ + [ ! -x "/usr/libexec/git-core/git-${1}" ] && \ + command -v "${1}" > /dev/null 2>&1 ; then + exec "${@}" +else + # else default to run command with git + exec git "${@}" +fi From 47e43c7f1de1f20a4a6e9a16cd8650240883041d Mon Sep 17 00:00:00 2001 From: Linus Lotz Date: Mon, 25 Mar 2019 17:35:25 +0100 Subject: [PATCH 2/2] Dockerfile: only install openssh client, use apk --no-cache --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e7519b1..16b8780 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,9 +4,7 @@ LABEL maintainer Bill Wang COPY docker-entrypoint.sh /docker-entrypoint.sh -RUN apk --update add git less openssh && \ - rm -rf /var/lib/apt/lists/* && \ - rm /var/cache/apk/* +RUN apk --update --no-cache add git less openssh-client VOLUME /git WORKDIR /git