55db2dbf18
- do not use a intermediate docker image between 'build' and 'test' - in 'build_deps', avoid downloading the cached image - in 'prepare', use `opam bundle` to: - embedded the sources of dependency - reduce the embedded opam repository to the needed package Other changes: - reintroduced 'sudo' in the base image, it is needed by `opam depext` and the job 'publish:doc' - moved the docker script used by the CI in `scripts/ci/`
63 lines
1.5 KiB
Bash
Executable File
63 lines
1.5 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
set -e
|
|
|
|
ci_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
|
script_dir="$(dirname "$ci_dir")"
|
|
src_dir="$(dirname "$script_dir")"
|
|
cd "$src_dir"
|
|
|
|
. "$script_dir"/version.sh
|
|
|
|
build_dir=${build_dir:-_docker_build}
|
|
|
|
if [ -f "$build_dir"/opam-$opam_tag ] && \
|
|
[ -f "$build_dir"/opam-installer-$opam_tag ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
tmp_image="opam.bin-builder"
|
|
tmp_dir=$(mktemp -dt tezos.opam.XXXXXXXX)
|
|
|
|
cleanup () {
|
|
set +e
|
|
rm -rf "$tmp_dir"
|
|
if ! [ -z "$container" ]; then docker rm $container; fi
|
|
# docker rmi $tmp_image || true
|
|
}
|
|
trap cleanup EXIT INT
|
|
|
|
opam_tag="${1:-$opam_tag}"
|
|
|
|
if ! [ -f "$build_dir"/opam-$opam_tag.tgz ]; then
|
|
echo
|
|
echo "### Fetching opam-$opam_tag.tar.gz ..."
|
|
echo
|
|
mkdir -p "$build_dir"
|
|
wget -O "$build_dir"/opam-$opam_tag.tgz \
|
|
https://github.com/ocaml/opam/archive/$opam_tag.tar.gz
|
|
fi
|
|
|
|
echo
|
|
echo "### Building opam ..."
|
|
echo
|
|
|
|
cp -a "$build_dir"/opam-$opam_tag.tgz "$tmp_dir"
|
|
|
|
cat <<EOF > "$tmp_dir"/Dockerfile
|
|
FROM ocaml/opam:alpine-${alpine_version}_ocaml-$ocaml_version
|
|
ENV PACKAGER "Tezos <ci@tezos.com>"
|
|
COPY opam-$opam_tag.tgz opam-$opam_tag.tgz
|
|
RUN tar xzf opam-$opam_tag.tgz && \
|
|
cd opam-$opam_tag && \
|
|
./configure && \
|
|
make lib-ext && \
|
|
make
|
|
EOF
|
|
|
|
docker build -t $tmp_image "$tmp_dir"
|
|
|
|
container=$(docker create $tmp_image)
|
|
docker cp -L $container:/home/opam/opam-$opam_tag/opam "$build_dir"/opam-$opam_tag
|
|
docker cp -L $container:/home/opam/opam-$opam_tag/opam-installer "$build_dir"/opam-installer-$opam_tag
|