-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-recipe
executable file
·52 lines (41 loc) · 1.24 KB
/
docker-recipe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
set -e
DOCKER_RECIPE_BASE="$( cd "$(dirname "$0")" ; pwd -P )"
DOCKER_RECIPE_PATH=${DOCKER_RECIPE_PATH-"$DOCKER_RECIPE_BASE/recipes"}
DOCKER_RECIPE_OS=${DOCKER_RECIPE_OS-"debian"}
function docker_recipe() {
for templateName in "${@}"; do
# Resolve recipe file
templateFiles=$(${DOCKER_RECIPE_BASE}/docker-recipe-find ${templateName})
for templateSource in ${templateFiles}; do
if [[ -x ${templateSource} ]]; then
source ${templateSource}
echo ""
continue;
fi
"${DOCKER_RECIPE_BASE}/docker-recipe-parse" "${templateSource}"
echo ""
done
done
}
if [[ -z "$1" ]];then
if [[ -f "Dockerfile.recipe" ]]; then
exec $0 Dockerfile.recipe > Dockerfile
exit $?
fi
echo "Usage: $0 <package-name>"
exit 1
fi
if [[ -x "$DOCKER_RECIPE_BASE/docker-recipe-$1" ]]; then
# Subcommand
cmd=$1
shift
exec "$DOCKER_RECIPE_BASE/docker-recipe-$cmd" ${*}
exit $?
fi
if [[ -f "$1" ]]; then
${DOCKER_RECIPE_BASE}/docker-recipe-parse $1
exit $?
fi
docker_recipe "${@}"
# grep apt Dockerfile | grep '\-y' | cut -d'y' -f2- | cut -d'>' -f1 | xargs echo 'RUN apt-purge -y'