diff --git a/.dockerignore b/.dockerignore index 5515ca5fa6f..945bd5a2a3a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,7 +13,6 @@ npm-debug.log README-secret.md # github related files .github/ -target scripts/target examples/target Dockerfile diff --git a/docker/Dockerfile.copy b/docker/Dockerfile.copy new file mode 100644 index 00000000000..7c14961e70d --- /dev/null +++ b/docker/Dockerfile.copy @@ -0,0 +1,40 @@ +FROM debian:latest + +RUN mkdir -p /opt/linera + +WORKDIR /opt/linera + +# Copying binaries +COPY target/release/linera . +COPY target/release/linera-server . +COPY target/release/linera-proxy . +COPY target/release/linera-db . + +# Copying configuration files +COPY configuration/k8s-local/validator_1.toml . + +# Copy entrypoint +COPY docker/server-entrypoint.sh . +RUN chmod +x server-entrypoint.sh + +# Copy init +COPY docker/server-init.sh . +RUN chmod +x server-init.sh + +RUN apt-get update && apt-get install -y libssl-dev + +# Create configuration files for the validator according to the validator's config file. +# * Private server states are stored in `server*.json`. +# * `committee.json` is the public description of the Linera committee. +RUN ./linera-server generate --validators validator_1.toml --committee committee.json + +# Create configuration files for 1000 user chains. +# * Private chain states are stored in one local wallet `wallet.json`. +# * `genesis.json` will contain the initial balances of chains as well as the initial committee. +RUN ./linera \ + --wallet wallet.json \ + --storage rocksdb:linera.db \ + create-genesis-config 1000 \ + --genesis genesis.json \ + --initial-funding 100 \ + --committee committee.json diff --git a/kubernetes/linera-validator/build_and_redeploy.sh b/kubernetes/linera-validator/build_and_redeploy.sh index eb1931d3d48..d8648ed4b3d 100755 --- a/kubernetes/linera-validator/build_and_redeploy.sh +++ b/kubernetes/linera-validator/build_and_redeploy.sh @@ -6,6 +6,7 @@ cloud_mode=false port_forward=false do_build=true clean=false +copy=false # Guard clause check if required binaries are installed which kind > /dev/null || { echo "Error: kind not installed." ; exit 1 ; } @@ -20,6 +21,7 @@ usage() { echo " --port-forward Start port forwarding at the end of the script, so that the validator is accessible. Don't use this if you plan to use this terminal for something else after running this script" echo " --no-build Don't actually build another version of the Docker image, just use the existing one for the current mode (cloud or not)" echo " --clean Clean up DB state and delete kind cluster before starting a new one. This will guarantee that the Validator state will be clean for the new run" + echo " --copy Have the Dockerfile copy over the already built binaries in the target/release directory. Binaries need to be built beforehand. Works only when --cloud is NOT set" } # Function to handle options and arguments @@ -42,6 +44,9 @@ handle_options() { --clean) clean=true ;; + --copy) + copy=true + ;; *) echo "Invalid option: $1" >&2 usage @@ -86,7 +91,9 @@ if [ "$cloud_mode" = true ]; then else docker_image="linera-test:latest" if [ "$do_build" = true ]; then - if [ "$(uname -m)" = "x86_64" ]; then + if [ "$copy" = true ]; then + docker build -f ../../docker/Dockerfile.copy ../../ -t $docker_image || exit 1 + elif [ "$(uname -m)" = "x86_64" ]; then docker build -f ../../docker/Dockerfile.local ../../ -t $docker_image || exit 1 else docker build -f ../../docker/Dockerfile.local-aarch64 ../../ -t $docker_image || exit 1