2021-01-07 09:19:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-02-02 22:31:01 +00:00
|
|
|
# Copyright (c) 2020-2021 Status Research & Development GmbH. Licensed under
|
2021-01-07 09:19:29 +00:00
|
|
|
# either of:
|
|
|
|
# - Apache License, version 2.0
|
|
|
|
# - MIT license
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
# according to those terms.
|
|
|
|
|
2021-03-10 02:59:19 +00:00
|
|
|
# Build release binaries fit for public distribution, using Docker.
|
2021-01-07 09:19:29 +00:00
|
|
|
# Should be used from "dist-*" Make targets, passing the target architecture's name as a parameter.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"/..
|
2021-02-06 20:22:25 +00:00
|
|
|
REPO_DIR="${PWD}"
|
2021-01-07 09:19:29 +00:00
|
|
|
|
|
|
|
ARCH="${1:-amd64}"
|
|
|
|
DOCKER_TAG="nimbus-eth2-dist-${ARCH}"
|
|
|
|
|
|
|
|
docker rm ${DOCKER_TAG} &>/dev/null || true
|
|
|
|
|
|
|
|
cd docker/dist
|
|
|
|
|
|
|
|
DOCKER_BUILDKIT=1 \
|
|
|
|
docker build \
|
|
|
|
-t ${DOCKER_TAG} \
|
|
|
|
--progress=plain \
|
|
|
|
--build-arg USER_ID=$(id -u) \
|
|
|
|
--build-arg GROUP_ID=$(id -g) \
|
|
|
|
-f Dockerfile.${ARCH} .
|
|
|
|
|
2021-05-13 18:58:52 +00:00
|
|
|
# seccomp can have some serious overhead, so we disable it with "--privileged" - https://pythonspeed.com/articles/docker-performance-overhead/
|
|
|
|
docker run --privileged --rm --name ${DOCKER_TAG} -v ${REPO_DIR}:/home/user/nimbus-eth2 ${DOCKER_TAG}
|
2021-01-07 09:19:29 +00:00
|
|
|
|
|
|
|
cd - &>/dev/null
|
|
|
|
|
|
|
|
ls -l dist
|
|
|
|
|
|
|
|
# We rebuild everything inside the container, so we need to clean up afterwards.
|
|
|
|
${MAKE} --no-print-directory clean
|
|
|
|
|