mirror of
https://github.com/eth-act/ere.git
synced 2026-04-03 03:00:17 -04:00
add zisk
This commit is contained in:
36
.github/workflows/check_zisk_image.yml
vendored
Normal file
36
.github/workflows/check_zisk_image.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Check ZisK Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build_zisk_image:
|
||||
name: Build ZisK Docker Image
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Build dependent Docker base image
|
||||
run: |
|
||||
docker build \
|
||||
--file docker/base/Dockerfile.base \
|
||||
--tag ere-base:latest \
|
||||
.
|
||||
|
||||
- name: Build ZisK Docker image
|
||||
run: |
|
||||
docker build \
|
||||
--file docker/zisk/Dockerfile \
|
||||
--tag ere-builder-zisk-check:latest \
|
||||
.
|
||||
52
docker/zisk/Dockerfile
Normal file
52
docker/zisk/Dockerfile
Normal file
@@ -0,0 +1,52 @@
|
||||
ARG BASE_IMAGE_TAG=latest
|
||||
FROM ere-base:${BASE_IMAGE_TAG}
|
||||
|
||||
# The ere-base image provides Rust, Cargo, and common tools.
|
||||
# ZisK requires Ubuntu 22.04 or higher (ere-base uses 22.04 by default).
|
||||
# We operate as root for SDK and dependency installation.
|
||||
|
||||
# Install ZisK system dependencies (for Ubuntu)
|
||||
# Taken from https://0xpolygonhermez.github.io/zisk/getting_started/installation.html
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
xz-utils \
|
||||
jq \
|
||||
# build-essential is in ere-base
|
||||
# curl is in ere-base
|
||||
# git is in ere-base
|
||||
qemu-system \
|
||||
libomp-dev \
|
||||
libgmp-dev \
|
||||
nlohmann-json3-dev \
|
||||
protobuf-compiler \
|
||||
uuid-dev \
|
||||
libgrpc++-dev \
|
||||
libsecp256k1-dev \
|
||||
libsodium-dev \
|
||||
libpqxx-dev \
|
||||
nasm \
|
||||
libopenmpi-dev \
|
||||
openmpi-bin \
|
||||
openmpi-common \
|
||||
libclang-dev \
|
||||
clang \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the ZisK SDK installer script from the workspace context
|
||||
COPY scripts/sdk_installers/install_zisk_sdk.sh /tmp/install_zisk_sdk.sh
|
||||
RUN chmod +x /tmp/install_zisk_sdk.sh
|
||||
|
||||
# Run the ZisK SDK installation script using ziskup.
|
||||
# This script installs the 'zisk' Rust toolchain and cargo-zisk.
|
||||
RUN /tmp/install_zisk_sdk.sh && rm /tmp/install_zisk_sdk.sh # Clean up the script
|
||||
|
||||
# The 'zisk' Rust toolchain is now installed.
|
||||
# cargo-zisk is installed in $HOME/.zisk/bin.
|
||||
# The install_zisk_sdk.sh script adds $HOME/.zisk/bin to PATH for its session.
|
||||
# For the image environment, we need to ensure $HOME/.zisk/bin is persistently in PATH.
|
||||
ENV ZISK_TOOLS_BIN_DIR="${HOME}/.zisk/bin"
|
||||
ENV PATH="${ZISK_TOOLS_BIN_DIR}:${PATH}"
|
||||
|
||||
# Verify cargo-zisk is accessible
|
||||
RUN echo "Verifying Zisk installation in Dockerfile ..." && cargo +zisk zisk --version
|
||||
|
||||
CMD ["/bin/bash"]
|
||||
78
scripts/sdk_installers/install_zisk_sdk.sh
Executable file
78
scripts/sdk_installers/install_zisk_sdk.sh
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# --- Utility functions (duplicated) ---
|
||||
# Checks if a tool is installed and available in PATH.
|
||||
is_tool_installed() {
|
||||
command -v "$1" &> /dev/null
|
||||
}
|
||||
|
||||
# Ensures a tool is installed. Exits with an error if not.
|
||||
ensure_tool_installed() {
|
||||
local tool_name="$1"
|
||||
local purpose_message="$2"
|
||||
if ! is_tool_installed "${tool_name}"; then
|
||||
echo "Error: Required tool '${tool_name}' could not be found." >&2
|
||||
if [ -n "${purpose_message}" ]; then
|
||||
echo " It is needed ${purpose_message}." >&2
|
||||
fi
|
||||
echo " Please install it first and ensure it is in your PATH." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
# --- End of Utility functions ---
|
||||
|
||||
echo "Installing ZisK Toolchain and SDK using ziskup (prebuilt binaries)..."
|
||||
|
||||
# Prerequisites for ziskup and ZisK (some of these are for the SDK itself beyond ziskup)
|
||||
ensure_tool_installed "curl" "to download the ziskup installer"
|
||||
ensure_tool_installed "bash" "to run the ziskup installer"
|
||||
ensure_tool_installed "rustup" "for managing Rust toolchains (ZisK installs its own)"
|
||||
ensure_tool_installed "cargo" "as cargo-zisk is a cargo subcommand"
|
||||
|
||||
# Run ziskup installer script with --provingkey to get a full setup.
|
||||
# This also installs the 'zisk' rust toolchain and cargo-zisk CLI.
|
||||
echo "Running ziskup installer with --provingkey option..."
|
||||
curl https://raw.githubusercontent.com/0xPolygonHermez/zisk/main/ziskup/install.sh | bash -s -- --provingkey
|
||||
|
||||
# ziskup installs tools like cargo-zisk to $HOME/.zisk/bin.
|
||||
# Add this to PATH for the current script session so we can verify cargo-zisk.
|
||||
ZISK_TOOLS_BIN_DIR="${HOME}/.zisk/bin"
|
||||
if [ -d "${ZISK_TOOLS_BIN_DIR}" ] && [[ ":$PATH:" != *":${ZISK_TOOLS_BIN_DIR}:"* ]]; then
|
||||
echo "Adding ${ZISK_TOOLS_BIN_DIR} to PATH for current script session."
|
||||
export PATH="${ZISK_TOOLS_BIN_DIR}:$PATH"
|
||||
fi
|
||||
|
||||
# Verify ZisK installation
|
||||
echo "Verifying ZisK installation..."
|
||||
|
||||
echo "Checking for 'zisk' toolchain..."
|
||||
if rustup toolchain list | grep -q "^zisk"; then
|
||||
echo "ZisK Rust toolchain found."
|
||||
else
|
||||
echo "Error: ZisK Rust toolchain ('zisk') not found after installation!" >&2
|
||||
echo " Attempting to run 'ziskup' again to ensure toolchain setup..."
|
||||
# Sometimes ziskup might need a second run or explicit toolchain setup if path issues occurred initially
|
||||
# However, for a script, we expect the first run to succeed. This is more of a diagnostic.
|
||||
if command -v ziskup &> /dev/null; then ziskup; fi
|
||||
if ! rustup toolchain list | grep -q "^zisk"; then
|
||||
echo "Critical Error: ZisK Rust toolchain still not found!" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Checking for cargo-zisk CLI tool (using +zisk toolchain)..."
|
||||
# TODO: cargo +zisk zisk to fix
|
||||
if cargo +zisk zisk --version; then
|
||||
echo "cargo-zisk CLI tool verified successfully."
|
||||
else
|
||||
echo "Error: 'cargo +zisk zisk --version' failed." >&2
|
||||
echo " Attempting verification with cargo-zisk directly (if in PATH from ${ZISK_TOOLS_BIN_DIR})..."
|
||||
if command -v cargo-zisk &> /dev/null && cargo-zisk --version; then
|
||||
echo "cargo-zisk found directly in PATH and verified."
|
||||
else
|
||||
echo "Error: cargo-zisk also not found directly or 'cargo +zisk zisk --version' failed." >&2
|
||||
echo " Ensure ${ZISK_TOOLS_BIN_DIR} is effectively in PATH for new shells and check ziskup output." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user