99cdf5e5c2
- Docker files and build scripts + add git, bash and patch to the docker base definition (Dockerfile.base) + build leveldb once and for all (scripts/create_docker_image.leveldb_deps.sh) + add --depth 1 to all git clone calls + remove sudo, openssh and rsync from base images + add --no-cache to all apk calls + merge dockerfiles in the sh scripts
49 lines
1.3 KiB
Bash
Executable File
49 lines
1.3 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
set -e
|
|
|
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
|
src_dir="$(dirname "$script_dir")"
|
|
cd "$src_dir"
|
|
|
|
. scripts/version.sh
|
|
image_name="${1:-tezos}"
|
|
image_version="${2:-latest}"
|
|
build_image_name="${3:-${image_name}_build:${image_version}}"
|
|
|
|
cleanup () {
|
|
set +e
|
|
echo Cleaning up...
|
|
rm -rf Dockerfile bin
|
|
}
|
|
trap cleanup EXIT INT
|
|
|
|
# assume $build_image_name has already been created
|
|
mkdir -p _docker_build_result
|
|
docker create --name tmp1 $build_image_name
|
|
docker cp -L tmp1:/home/opam/tezos/_build/install/default/bin/tezos-client _docker_build_result/
|
|
docker cp -L tmp1:/home/opam/tezos/_build/install/default/bin/tezos-node _docker_build_result/
|
|
docker rm tmp1
|
|
|
|
# assume tezos/leveldb has already been created
|
|
mkdir -p _docker_build_result/leveldb
|
|
mkdir -p _docker_build_result/keys
|
|
docker create --name tmp1 tezos/leveldb
|
|
docker cp -L tmp1:/etc/apk/keys _docker_build_result/
|
|
docker cp -L tmp1:/packages _docker_build_result/
|
|
docker rm tmp1
|
|
|
|
echo
|
|
echo "### Building minimal docker image..."
|
|
echo
|
|
|
|
sed -e 's|$alpine_version|'"$alpine_version"'|g' \
|
|
scripts/Dockerfile.minimal.in > Dockerfile
|
|
docker build -t "$image_name:$image_version" .
|
|
|
|
echo
|
|
echo "### Succesfully build docker image: $image_name:$image_version"
|
|
echo
|
|
|
|
rm -Rf _docker_build_result
|