Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add explicit docker-entrypoint to comply with official image rules #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
l-lotz marked this conversation as resolved.
Show resolved Hide resolved

# 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