Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ FROM alpine

LABEL maintainer Bill Wang <ozbillwang@gmail.com>

RUN apk --update add git less openssh && \
rm -rf /var/lib/apt/lists/* && \
rm /var/cache/apk/*
COPY docker-entrypoint.sh /docker-entrypoint.sh

RUN apk --update --no-cache add git less openssh-client

VOLUME /git
WORKDIR /git

ENTRYPOINT ["git"]
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["--help"]
18 changes: 18 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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