ligo/scripts/ci/create_docker_image.build.sh
Grégoire Henry 55db2dbf18 CI: improve pipeline duration
- 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/`
2018-01-28 20:03:31 +01:00

42 lines
826 B
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
export build_dir=${build_dir:-_docker_build}
tmp_dir=$(mktemp -dt tezos.opam.tezos.XXXXXXXX)
cleanup () {
set +e
echo Cleaning up...
rm -rf Dockerfile
}
trap cleanup EXIT INT
image_name="${1:-tezos_build}"
image_version="${2:-latest}"
base_image_name="${3-${image_name}_deps:${image_version}}"
cat <<EOF > "$src_dir"/Dockerfile
FROM $base_image_name
COPY . tezos
RUN sudo chown -R opam tezos && \
opam exec -- make -C tezos all build-test
EOF
echo
echo "### Building tezos..."
echo
docker build -t "$image_name:$image_version" "$src_dir"
echo
echo "### Succesfully build docker image: $image_name:$image_version"
echo