-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild_bases.sh
executable file
·59 lines (44 loc) · 1.16 KB
/
build_bases.sh
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
54
55
56
57
58
59
#!/bin/bash
set -Eeuo pipefail
SCRIPTNAME=$(basename "${BASH_SOURCE[0]}")
APP_ROOT=$(dirname "${BASH_SOURCE[0]}")
GIT_REPO=contrast-security-oss/vulneruby_engine
RUBY_VERS="3 3.1 3.2"
usage() {
cat <<EOF
Usa ge: $SCRIPTNAME [-h] [options]
Build and upload base images for supported Ruby versions: $RUBY_VERS
Sign into GitHub with a PAT before running this.
To do this in pipeline, research:
https://docs.github.com/en/packages/guides/pushing-and-pulling-docker-images
'you can use the GITHUB_TOKEN to publish and install packages'
Available options:
-h, --help Print this help and exit
EOF
exit
}
die() {
local msg=$1
local code=${2-1} # default exit status 1
echo "$msg"
exit "$code"
}
parse_params() {
# Actual parsing.
while :; do
case "${1-}" in
-h | --help) usage ;;
-?*) die "Unknown option: $1" ;;
*) break ;;
esac
shift
done
args=("$@")
return 0
}
parse_params "$@"
for ver in $RUBY_VERS; do
TAG=ghcr.io/$GIT_REPO/base:$ver
docker build --tag $TAG --build-arg RUBY_VER=$ver -f $APP_ROOT/docker/Dockerfile_base $APP_ROOT
docker push $TAG
done