Skip to content

Commit f176829

Browse files
committed
Add explicit docker-entrypoint to comply with official image rules
1 parent c5b7aa9 commit f176829

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@ FROM alpine
22

33
LABEL maintainer Bill Wang <[email protected]>
44

5+
COPY docker-entrypoint.sh /docker-entrypoint.sh
6+
57
RUN apk --update add git less openssh && \
68
rm -rf /var/lib/apt/lists/* && \
7-
rm /var/cache/apk/*
9+
rm /var/cache/apk/* && \
10+
chmod +x /docker-entrypoint.sh
811

912
VOLUME /git
1013
WORKDIR /git
1114

12-
ENTRYPOINT ["git"]
15+
ENTRYPOINT ["/docker-entrypoint.sh"]
1316
CMD ["--help"]

docker-entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
# A beginning user should be able to docker run image bash (or sh) without
4+
# needing to learn about --entrypoint
5+
# https://github.com/docker-library/official-images#consistency
6+
7+
set -e
8+
9+
# run command if it is not starting with a "-", is not a git subcommand and is an executable in PATH
10+
if [ "${#}" -gt 0 -a "${1#-}" == "${1}" -a ! -x "/usr/libexec/git-core/git-${1}" ] && which "${1}" > /dev/null 2>&1 ; then
11+
exec "${@}"
12+
else
13+
# else default to run command with git
14+
exec git "${@}"
15+
fi

0 commit comments

Comments
 (0)