-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·53 lines (41 loc) · 966 Bytes
/
Copy pathbuild.sh
File metadata and controls
executable file
·53 lines (41 loc) · 966 Bytes
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
53
#!/bin/bash
# error codes
# 2 Invalid base image
declare -A base_images
base_images[slim]=python:slim
DEFAULT_BASE_IMAGE=slim
DEFAULT_TAG=local
DEFAULT_USE_PROXY=N
tag=$DEFAULT_TAG
use_proxy=$DEFAULT_USE_PROXY
while getopts b:t:p: flag
do
case "${flag}" in
b) base_image=${OPTARG};;
t) tag=${OPTARG};;
p) proxy=${OPTARG};;
esac
done
echo "base_image: $base_image";
echo "tag: $tag";
echo "proxy: $proxy";
if [ -z "${base_image}" ]; then
base_image=$DEFAULT_BASE_IMAGE
fi
if [ -z "${proxy}" ]; then
use_proxy="N"
else
use_proxy=$proxy
fi
expanded_base_image=${base_images[$base_image]}
if [ -z "${expanded_base_image}" ]; then
echo "invalid base image ["${base_image}"]"
exit 2
fi
echo "Base Image: ["$expanded_base_image"]"
echo "Tag: ["$tag"]"
echo "Proxy: ["$use_proxy"]"
docker build . \
--build-arg BASE_IMAGE=${expanded_base_image} \
--build-arg USE_APT_PROXY=${use_proxy} \
-t giof71/yams:$tag