add docker files for openVM

This commit is contained in:
Kevaundray Wedderburn
2025-05-11 18:56:57 +01:00
parent ba443c270d
commit dcf0c8f7da
3 changed files with 111 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
name: Check OpenVM Docker Image
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
jobs:
build_openvm_image:
name: Build OpenVM 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 OpenVM Docker image
run: |
docker build \
--file docker/openvm/Dockerfile \
--tag ere-builder-openvm-check:latest \
.

23
docker/openvm/Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
ARG BASE_IMAGE_TAG=latest
FROM ere-base:${BASE_IMAGE_TAG}
# The ere-base image provides Rust, Cargo, and common tools.
# We operate as root for SDK installation.
# Copy the OpenVM SDK installer script from the workspace context
COPY scripts/sdk_installers/install_openvm_sdk.sh /tmp/install_openvm_sdk.sh
RUN chmod +x /tmp/install_openvm_sdk.sh
# Run the OpenVM SDK installation script.
# This script installs a specific toolchain
# and installs cargo-openvm.
RUN /tmp/install_openvm_sdk.sh && rm /tmp/install_openvm_sdk.sh
# The specific Rust toolchain for OpenVM is now installed.
# cargo-openvm is installed in $CARGO_HOME/bin, which is already in PATH from ere-base.
ENV OPENVM_TOOLCHAIN_VERSION="nightly-2025-02-14"
# Verify cargo-openvm is accessible with the correct toolchain
RUN cargo "+${OPENVM_TOOLCHAIN_VERSION}" openvm --version
CMD ["/bin/bash"]

View File

@@ -0,0 +1,52 @@
#!/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 OpenVM Toolchain..."
ensure_tool_installed "rustup" "to manage Rust toolchains"
ensure_tool_installed "git" "to install cargo-openvm from a git repository"
ensure_tool_installed "cargo" "to build and install Rust packages"
OPENVM_TOOLCHAIN_VERSION="nightly-2025-02-14"
OPENVM_CLI_VERSION_TAG="v1.1.2"
# Install the specific nightly toolchain for OpenVM
echo "Installing OpenVM-specific Rust toolchain: ${OPENVM_TOOLCHAIN_VERSION}..."
rustup install "${OPENVM_TOOLCHAIN_VERSION}"
rustup component add rust-src --toolchain "${OPENVM_TOOLCHAIN_VERSION}"
# Install cargo-openvm using the specified toolchain and version tag
echo "Installing cargo-openvm (version ${OPENVM_CLI_VERSION_TAG}) from GitHub repository (openvm-org/openvm)..."
cargo "+${OPENVM_TOOLCHAIN_VERSION}" install --locked --git https://github.com/openvm-org/openvm.git --tag "${OPENVM_CLI_VERSION_TAG}" cargo-openvm
# Verify cargo-openvm installation
echo "Verifying cargo-openvm installation..."
# The cargo-openvm is installed as `cargo-openvm`, so it's invoked as `cargo openvm`
if cargo "+${OPENVM_TOOLCHAIN_VERSION}" openvm --version; then
echo "cargo-openvm installation verified successfully."
else
echo "Error: 'cargo openvm --version' failed. cargo-openvm might not have installed correctly." >&2
echo " Ensure ${HOME}/.cargo/bin is in your PATH for new shells." >&2
exit 1
fi