File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,15 @@ FROM alpine
2
2
3
3
LABEL maintainer Bill Wang <
[email protected] >
4
4
5
+ COPY docker-entrypoint.sh /docker-entrypoint.sh
6
+
5
7
RUN apk --update add git less openssh && \
6
8
rm -rf /var/lib/apt/lists/* && \
7
- rm /var/cache/apk/*
9
+ rm /var/cache/apk/* && \
10
+ chmod +x /docker-entrypoint.sh
8
11
9
12
VOLUME /git
10
13
WORKDIR /git
11
14
12
- ENTRYPOINT ["git " ]
15
+ ENTRYPOINT ["/docker-entrypoint.sh " ]
13
16
CMD ["--help" ]
Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments