add initial risc0 docker files

This commit is contained in:
Kevaundray Wedderburn
2025-05-11 18:13:11 +01:00
parent cb99c23b38
commit 0f32ad0578
3 changed files with 91 additions and 0 deletions

33
.github/workflows/test-risc0-docker.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Test Risc0 (Docker)
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test-risc0-via-docker-build:
name: Build Risc0 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 ere-base image
run: |
docker build \
--tag ere-base:latest \
--file docker/base/Dockerfile.base .
- name: Build ere-builder-risc0 image
run: |
docker build \
--tag ere-builder-risc0:latest \
--file docker/risc0/Dockerfile .

23
docker/risc0/Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
ARG BASE_IMAGE_TAG=latest
FROM ere-base:${BASE_IMAGE_TAG}
ARG USERNAME=ere_user
USER root
# Ensure Cargo/Rustup environment variables are set from the base image for SDK script
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
# Copy and run the Risc0 SDK installer script
COPY scripts/sdk_installers/install_risc0_sdk.sh /tmp/install_risc0_sdk.sh
RUN chmod +x /tmp/install_risc0_sdk.sh
# Run the script without version arguments to install latest
# TODO: We need to change this in all scripts so that we can fix the version in CI
RUN /tmp/install_risc0_sdk.sh
# Verify Risc0 installation (script also does this, but good for Dockerfile sanity)
RUN echo "Verifying Risc0 installation in Dockerfile (post-script)..." && cargo risczero --version
CMD ["/bin/bash"]

View File

@@ -0,0 +1,35 @@
#!/bin/bash
set -e
echo "Installing Risc0 Toolchain using rzup (latest release versions)..."
# Ensure curl and bash are available
if ! command -v curl &> /dev/null; then echo "Error: curl not found." >&2; exit 1; fi
if ! command -v bash &> /dev/null; then echo "Error: bash not found." >&2; exit 1; fi
# Install rzup itself if not already present
if ! command -v rzup &> /dev/null; then
echo "Installing rzup..."
curl -L https://risczero.com/install | bash
# Attempt to add rzup to PATH for the current script execution if it was just installed
# Common install location for rzup is $HOME/.cargo/bin
if [[ ":$PATH:" != *":$HOME/.cargo/bin:"* ]]; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
if ! command -v rzup &> /dev/null; then
echo "Error: rzup still not found after install attempt. Ensure $HOME/.cargo/bin is in your PATH or rzup installed correctly." >&2;
exit 1;
fi
else
echo "rzup already installed."
fi
# Install the latest released Risc0 toolchain
rzup install
# Verify Risc0 installation
echo "Verifying Risc0 installation..."
if ! command -v cargo &> /dev/null; then echo "Error: cargo not found." >&2; exit 1; fi
cargo risczero --version || (echo "Error: cargo risczero command failed!" >&2 && exit 1)
echo "Risc0 Toolchain installation (latest release) successful."