This commit is contained in:
Kevaundray Wedderburn
2025-05-11 19:09:15 +01:00
parent dcf0c8f7da
commit 893df214e1
3 changed files with 103 additions and 0 deletions

36
.github/workflows/check_jolt_image.yml vendored Normal file
View File

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

20
docker/jolt/Dockerfile Normal file
View File

@@ -0,0 +1,20 @@
ARG BASE_IMAGE_TAG=latest
FROM ere-base:${BASE_IMAGE_TAG}
# The ere-base image provides Rust, Cargo (with a default nightly), and common tools.
# We operate as root for SDK installation.
# Copy the Jolt SDK (CLI) installer script from the workspace context
COPY scripts/sdk_installers/install_jolt_sdk.sh /tmp/install_jolt_sdk.sh
RUN chmod +x /tmp/install_jolt_sdk.sh
# Run the Jolt CLI installation script.
# This script installs the 'jolt' binary to $CARGO_HOME/bin.
RUN /tmp/install_jolt_sdk.sh && rm /tmp/install_jolt_sdk.sh # Clean up the script
# The jolt CLI is installed in $CARGO_HOME/bin, which is already in PATH from ere-base.
# Verify jolt CLI is accessible.
RUN jolt --version
CMD ["/bin/bash"]

View File

@@ -0,0 +1,47 @@
#!/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 Jolt CLI..."
ensure_tool_installed "rustup" "to manage Rust toolchains (though Jolt uses default nightly)"
ensure_tool_installed "git" "to install Jolt from a git repository"
ensure_tool_installed "cargo" "to build and install Rust packages"
# Install Jolt CLI using cargo install with +nightly
# This installs the 'jolt' binary directly to $HOME/.cargo/bin
# The ere-base image should have a compatible default nightly toolchain.
echo "Installing Jolt CLI from GitHub repository (a16z/jolt)..."
cargo +nightly install --git https://github.com/a16z/jolt --force --bins jolt
# Verify Jolt installation
echo "Verifying Jolt CLI installation..."
if jolt --version; then
echo "Jolt CLI installation verified successfully."
else
echo "Error: 'jolt --version' failed. Jolt CLI might not have installed correctly." >&2
echo " Ensure ${HOME}/.cargo/bin is in your PATH for new shells." >&2
exit 1
fi
echo "Jolt CLI installation successful."