2020-02-10 14:35:05 +04:00
|
|
|
#!/bin/sh
|
|
|
|
set -e
|
2020-02-10 14:35:31 +04:00
|
|
|
set -x
|
2020-02-10 14:35:05 +04:00
|
|
|
|
2020-01-22 19:16:08 +04:00
|
|
|
# This script accepts three arguments, os family, os and its version,
|
2019-08-12 12:41:53 +04:00
|
|
|
# which are subsequently used to fetch the respective docker
|
|
|
|
# image from the ocaml/infrastructure project.
|
|
|
|
#
|
|
|
|
# https://github.com/ocaml/infrastructure/wiki/Containers#selecting-linux-distributions
|
2020-02-10 14:35:05 +04:00
|
|
|
target_os_family="$1"
|
|
|
|
target_os="$2"
|
|
|
|
target_os_version="$3"
|
2019-08-12 12:41:53 +04:00
|
|
|
|
|
|
|
# Variables configured at the CI level
|
|
|
|
dist="$LIGO_DIST_DIR"
|
|
|
|
version="$(echo $CI_JOB_ID)-$(echo $CI_COMMIT_SHORT_SHA)"
|
|
|
|
ci_job_id="$CI_JOB_ID"
|
|
|
|
|
|
|
|
# Image names for building & packaging
|
|
|
|
target="$target_os-$target_os_version"
|
|
|
|
tag_build="$LIGO_REGISTRY_IMAGE_BASE_NAME-build-$target:$version"
|
|
|
|
tag_package="$LIGO_REGISTRY_IMAGE_BASE_NAME-package-$target:$version"
|
|
|
|
tag_package_dockerized="$LIGO_REGISTRY_IMAGE_BASE_NAME-$target:$version"
|
|
|
|
|
|
|
|
|
|
|
|
# Check if there's a specific dockerfile override for
|
|
|
|
# the current target_os_family (e.g. debian-ish distros) or target_os (ubuntu, xubuntu, ...) and use it if there is one
|
|
|
|
target_os_family_specific_dockerfile="./docker/distribution/$target_os_family/$dockerfile_name.Dockerfile"
|
|
|
|
if test -f "$target_os_family_specific_dockerfile"; then
|
|
|
|
dockerfile="$target_os_family_specific_dockerfile"
|
|
|
|
fi
|
|
|
|
|
|
|
|
target_os_specific_dockerfile="./docker/distribution/$target_os_family/$target_os/$dockerfile_name.Dockerfile"
|
|
|
|
if test -f "$target_os_specific_dockerfile"; then
|
|
|
|
dockerfile="$target_os_specific_dockerfile"
|
2020-02-10 14:35:05 +04:00
|
|
|
fi
|