Browse Source

Merge pull request #1888 from stuart-c/add_entrypoint

Add bashbrew as the entrypoint to make using the image easier
Tianon Gravi 9 years ago
parent
commit
c7c9c1d12b
2 changed files with 17 additions and 0 deletions
  1. 3 0
      Dockerfile
  2. 14 0
      bashbrew/bashbrew-entrypoint.sh

+ 3 - 0
Dockerfile

@@ -39,3 +39,6 @@ COPY . $DIR
 RUN cd bashbrew/go && gb build
 RUN cd bashbrew/go && gb build
 
 
 VOLUME $BASHBREW_CACHE
 VOLUME $BASHBREW_CACHE
+
+RUN ln -s "$PWD/bashbrew/bashbrew-entrypoint.sh" /usr/local/bin/bashbrew-entrypoint.sh
+ENTRYPOINT ["bashbrew-entrypoint.sh"]

+ 14 - 0
bashbrew/bashbrew-entrypoint.sh

@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+
+if [ "${1:0:1}" = '-' ]; then
+	set -- bashbrew "$@"
+fi
+
+# if our command is a valid bashbrew subcommand, let's invoke it through bashbrew instead
+# (this allows for "docker run bashbrew build", etc)
+if bashbrew "$1" --help > /dev/null 2>&1; then
+	set -- bashbrew "$@"
+fi
+
+exec "$@"