mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
123 lines
3.7 KiB
Bash
Executable file
123 lines
3.7 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
IFS=$'\n\t'
|
|
|
|
function print_golang_args() {
|
|
|
|
case "$1" in
|
|
1.8)
|
|
INSTALL_GOLANG_VERSION=1.8.6
|
|
GOLANG_DOWNLOAD_SHA256=f558c91c2f6aac7222e0bd83e6dd595b8fac85aaa96e55d15229542eb4aaa1ff
|
|
;;
|
|
1.9)
|
|
INSTALL_GOLANG_VERSION=1.9.2
|
|
GOLANG_DOWNLOAD_SHA256=de874549d9a8d8d8062be05808509c09a88a248e77ec14eb77453530829ac02b
|
|
;;
|
|
*) echo "Unknown golang version $1"; exit 1;
|
|
esac
|
|
|
|
printf -- "--build-arg INSTALL_GOLANG_VERSION=%s " "$INSTALL_GOLANG_VERSION"
|
|
printf -- "--build-arg GOLANG_DOWNLOAD_SHA256=%s " "$GOLANG_DOWNLOAD_SHA256"
|
|
}
|
|
|
|
function print_chrome_args() {
|
|
case "$1" in
|
|
60|60.0) CHROME_VERSION=60.0.3112.90-1 ;;
|
|
61|61.0) CHROME_VERSION=61.0.3163.100-1 ;;
|
|
62|62.0) CHROME_VERSION=62.0.3202.89-1 ;;
|
|
63|63.0) CHROME_VERSION=63.0.3239.108-1 ;;
|
|
64|64.0) CHROME_VERSION=64.0.3282.119-1 ;;
|
|
*) echo "Unknown chrome version $1"; exit 1;
|
|
esac
|
|
printf -- "--build-arg CHROME_VERSION=%s " "$CHROME_VERSION"
|
|
}
|
|
|
|
function print_git_args() {
|
|
case "$1" in
|
|
2.7)
|
|
# Code-debt: When the build refers to "git 2.7" its actually "default" git.
|
|
# so don't actually install a git 2.7 as a default copy is already installed
|
|
return
|
|
;;
|
|
2.8|2.8.4)
|
|
GIT_VERSION=2.8.4
|
|
GIT_DOWNLOAD_SHA256=626e319f8a24fc0866167ea5f6bf3e2f38f69d6cb2e59e150f13709ca3ebf301
|
|
;;
|
|
2.9|2.9.0)
|
|
GIT_VERSION=2.9.0
|
|
GIT_DOWNLOAD_SHA256=bff7560f5602fcd8e37669e0f65ef08c6edc996e4f324e4ed6bb8a84765e30bd
|
|
;;
|
|
2.13)
|
|
GIT_VERSION=2.13.6
|
|
GIT_DOWNLOAD_SHA256=cb53e6b388d8d19189933366c1fe5c1ca500e8b227b9e707af39c3d879e41015
|
|
;;
|
|
2.14)
|
|
GIT_VERSION=2.14.3
|
|
GIT_DOWNLOAD_SHA256=023ffff6d3ba8a1bea779dfecc0ed0bb4ad68ab8601d14435dd8c08416f78d7f
|
|
;;
|
|
*) echo "Unknown git version $1"; exit 1;
|
|
esac
|
|
|
|
printf -- "--build-arg GIT_VERSION=%s " "$GIT_VERSION"
|
|
printf -- "--build-arg GIT_DOWNLOAD_SHA256=%s " "$GIT_DOWNLOAD_SHA256"
|
|
}
|
|
|
|
function print_node_args() {
|
|
case "$1" in
|
|
7.x|7.1) NODE_INSTALL_VERSION=7.x ;;
|
|
8.x) NODE_INSTALL_VERSION=8.x ;;
|
|
*) echo "Unknown node version $1"; exit 1;
|
|
esac
|
|
printf -- "--build-arg NODE_INSTALL_VERSION=%s " "$NODE_INSTALL_VERSION"
|
|
}
|
|
|
|
function print_yarn_args() {
|
|
case "$1" in
|
|
1.0) YARN_INSTALL_VERSION=1.0.2-1 ;;
|
|
1.2) YARN_INSTALL_VERSION=1.2.1-1 ;;
|
|
*) echo "Unknown yarn version $1"; exit 1;
|
|
esac
|
|
printf -- "--build-arg YARN_INSTALL_VERSION=%s " "$YARN_INSTALL_VERSION"
|
|
}
|
|
|
|
function print_postgres_args() {
|
|
printf -- "--build-arg POSTGRES_VERSION=%s " "$1"
|
|
}
|
|
|
|
function parse_arguments() {
|
|
read base
|
|
read base_version
|
|
printf -- "-f Dockerfile.custom " "$base"
|
|
printf -- "--build-arg CUSTOM_IMAGE_NAME=%s " "$base"
|
|
printf -- "--build-arg CUSTOM_IMAGE_VERSION=%s " "$base_version"
|
|
while read image; do
|
|
read version
|
|
case "$image" in
|
|
golang) print_golang_args $version ;;
|
|
chrome) print_chrome_args $version ;;
|
|
git) print_git_args $version ;;
|
|
node) print_node_args $version ;;
|
|
yarn) print_yarn_args $version ;;
|
|
postgresql) print_postgres_args $version ;;
|
|
*) exit 1;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
function generate_command() {
|
|
buildimage_name=$1; shift;
|
|
|
|
printf -- "docker build "
|
|
echo $buildimage_name | tr '-' '\n' | parse_arguments
|
|
|
|
for i in "$@"
|
|
do
|
|
printf -- "%s " "$i"
|
|
done
|
|
printf -- ".\\n"
|
|
}
|
|
|
|
docker_command=$(generate_command $@)
|
|
echo "$1: executing $docker_command"
|
|
eval $docker_command
|