Skip to content

Commit

Permalink
Add a simple initial "bashbrew" Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tianon committed Oct 15, 2015
1 parent 61eeb20 commit 54539d3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
1 change: 1 addition & 0 deletions .dockerignore
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*~
*.pyc
/bashbrew/logs
/bashbrew/src
.git
bashbrew/logs
bashbrew/src
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM docker:git

RUN apk add --update \
bash \
&& rm -rf /var/cache/apk/*

ENV DIR /usr/src/official-images
WORKDIR $DIR
COPY . $DIR
RUN ln -s "$(readlink -f bashbrew/bashbrew.sh)" /usr/local/bin/bashbrew

VOLUME $DIR/bashbrew/logs $DIR/bashbrew/src
15 changes: 10 additions & 5 deletions bashbrew/bashbrew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ trap 'echo >&2 Ctrl+C captured, exiting; exit 1' SIGINT

dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

library="$dir/../library"
library="$(dirname "$dir")/library"
src="$dir/src"
logs="$dir/logs"
namespaces='_'
docker='docker'
retries='4'

library="$(readlink -f "$library")"
src="$(readlink -f "$src")"
logs="$(readlink -f "$logs")"

self="$(basename "$0")"

usage() {
Expand Down Expand Up @@ -107,6 +103,15 @@ while true; do
esac
done

if [ ! -d "$library" ]; then
echo >&2 "error: library directory '$library' does not exist"
exit 1
fi
library="$(readlink -f "$library")"
mkdir -p "$src" "$logs"
src="$(readlink -f "$src")"
logs="$(readlink -f "$logs")"

# which subcommand
subcommand="$1"
shift || { usage >&2 && exit 1; }
Expand Down

0 comments on commit 54539d3

Please sign in to comment.