mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-26 08:59:45 +00:00
Merge pull request #566 from logos-blockchain/arjentix/fix-docker-builds
fix(docker): fix dockerfiles to properly build images
This commit is contained in:
commit
70d33f5a16
@ -1,19 +0,0 @@
|
||||
name: Setup Logos Blockchain Circuits
|
||||
|
||||
description: Set up Logos Blockchain Circom Circuits, Rapidsnark prover and Rapidsnark verifier using the setup-logos-blockchain-circuits.sh script.
|
||||
|
||||
inputs:
|
||||
github-token:
|
||||
description: GitHub token for downloading releases
|
||||
required: true
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Setup logos-blockchain-circuits
|
||||
shell: bash
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ inputs.github-token }}
|
||||
run: |
|
||||
curl -sSL https://raw.githubusercontent.com/logos-blockchain/logos-blockchain/6ac348bea4160ca708b70a86b3964e9f1ce82fff/scripts/setup-logos-blockchain-circuits.sh | bash
|
||||
16
.github/workflows/publish_images.yml
vendored
16
.github/workflows/publish_images.yml
vendored
@ -16,16 +16,20 @@ jobs:
|
||||
dockerfile: ./lez/sequencer/service/Dockerfile
|
||||
build_args: |
|
||||
STANDALONE=false
|
||||
needs_risc0: true
|
||||
- name: sequencer_service-standalone
|
||||
dockerfile: ./lez/sequencer/service/Dockerfile
|
||||
build_args: |
|
||||
STANDALONE=true
|
||||
needs_risc0: true
|
||||
- name: indexer_service
|
||||
dockerfile: ./lez/indexer/service/Dockerfile
|
||||
build_args: ""
|
||||
needs_risc0: true
|
||||
- name: explorer_service
|
||||
dockerfile: ./lez/explorer_service/Dockerfile
|
||||
build_args: ""
|
||||
needs_risc0: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
@ -53,6 +57,17 @@ jobs:
|
||||
type=sha,prefix=sha-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build risc0 base image
|
||||
if: ${{ matrix.needs_risc0 }}
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./lez/docker/risc0-base.Dockerfile
|
||||
load: true
|
||||
tags: lez/risc0_base:ci
|
||||
cache-from: type=gha,scope=risc0-base
|
||||
cache-to: type=gha,mode=max,scope=risc0-base
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
@ -62,5 +77,6 @@ jobs:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: ${{ matrix.build_args }}
|
||||
build-contexts: ${{ matrix.needs_risc0 && 'risc0_base=docker-image://lez/risc0_base:ci' || '' }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
4
Justfile
4
Justfile
@ -59,10 +59,10 @@ run-indexer mock="":
|
||||
@echo "🔍 Running indexer"
|
||||
@if [ "{{mock}}" = "mock" ]; then \
|
||||
echo "🧪 Using mock data"; \
|
||||
RUST_LOG=info cargo run --release --features mock-responses -p indexer_service configs/indexer_config.json; \
|
||||
RUST_LOG=info cargo run --release --features mock-responses -p indexer_service configs/debug/indexer_config.json; \
|
||||
else \
|
||||
echo "🚀 Using real data"; \
|
||||
RUST_LOG=info cargo run --release -p indexer_service configs/indexer_config.json; \
|
||||
RUST_LOG=info cargo run --release -p indexer_service configs/debug/indexer_config.json; \
|
||||
fi
|
||||
|
||||
# Run Explorer.
|
||||
|
||||
@ -156,7 +156,7 @@ The sequencer and logos blockchain node can be run locally:
|
||||
- `docker compose up`
|
||||
|
||||
2. On another terminal go to the `logos-blockchain/logos-execution-zone` repo and run indexer service:
|
||||
- `RUST_LOG=info cargo run -p indexer_service lez/indexer/service/configs/indexer_config.json`
|
||||
- `RUST_LOG=info cargo run -p indexer_service lez/indexer/service/configs/debug/indexer_config.json`
|
||||
|
||||
3. On another terminal go to the `logos-blockchain/logos-execution-zone` repo and run the sequencer:
|
||||
- `RUST_LOG=info cargo run -p sequencer_service lez/sequencer/service/configs/debug/sequencer_config.json`
|
||||
|
||||
@ -3,7 +3,7 @@ services:
|
||||
logos-blockchain-node-0:
|
||||
image: ghcr.io/logos-blockchain/logos-blockchain@sha256:91d6c5bf07e07fcfba5e7cf07d21ee686a6bc4b9f6210f2d28bffbcad9a3729f
|
||||
ports:
|
||||
- "${PORT:-8080}:18080/tcp"
|
||||
- "${PORT:-18080}:18080/tcp"
|
||||
volumes:
|
||||
- ./scripts:/etc/logos-blockchain/scripts
|
||||
- ./kzgrs_test_params:/kzgrs_test_params:z
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
services:
|
||||
logos-blockchain-node-0:
|
||||
ports: !override
|
||||
- "18080:18080/tcp"
|
||||
environment:
|
||||
- RUST_LOG=error
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
"node_url": "http://logos-blockchain-node-0:18080"
|
||||
},
|
||||
"indexer_rpc_url": "ws://indexer_service:8779",
|
||||
"genesis": [
|
||||
{
|
||||
"supply_bridge_account": {
|
||||
|
||||
47
lez/docker/risc0-base.Dockerfile
Normal file
47
lez/docker/risc0-base.Dockerfile
Normal file
@ -0,0 +1,47 @@
|
||||
# Shared build base: cargo-chef toolchain + risc0 r0vm.
|
||||
#
|
||||
# This is the single source of truth for the r0vm install that the sequencer
|
||||
# and indexer service images depend on. It is consumed as a named build context
|
||||
# called `risc0_base` (the service Dockerfiles start with `FROM risc0_base`).
|
||||
#
|
||||
# Wiring:
|
||||
# - docker-compose: `build.additional_contexts: { risc0_base: "service:risc0_base" }`
|
||||
# - CI: built first and passed via `build-contexts: risc0_base=docker-image://...`
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.94.0-slim-trixie
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libclang-dev \
|
||||
clang \
|
||||
cmake \
|
||||
ninja-build \
|
||||
curl \
|
||||
unzip \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install r0vm
|
||||
# Use quick install for x86-64 (risczero provides binaries only for this linux platform)
|
||||
# Manual build for other platforms (including arm64 Linux)
|
||||
RUN ARCH=$(uname -m); \
|
||||
if [ "$ARCH" = "x86_64" ]; then \
|
||||
echo "Using quick install for $ARCH"; \
|
||||
curl -L https://risczero.com/install | bash; \
|
||||
export PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}"; \
|
||||
rzup install; \
|
||||
else \
|
||||
echo "Using manual build for $ARCH"; \
|
||||
git clone --depth 1 --branch release-3.0 https://github.com/risc0/risc0.git; \
|
||||
git clone --depth 1 --branch risc0-1.94.1 https://github.com/risc0/rust.git; \
|
||||
cd /risc0; \
|
||||
cargo install --locked --path rzup; \
|
||||
rzup build --path /rust rust --verbose; \
|
||||
cargo install --locked --path risc0/cargo-risczero; \
|
||||
fi
|
||||
ENV PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}"
|
||||
RUN cp "$(which r0vm)" /usr/local/bin/r0vm
|
||||
RUN test -x /usr/local/bin/r0vm
|
||||
RUN r0vm --version
|
||||
@ -2,10 +2,10 @@ services:
|
||||
explorer_service:
|
||||
image: lez/explorer_service
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: explorer_service/Dockerfile
|
||||
context: ../..
|
||||
dockerfile: lez/explorer_service/Dockerfile
|
||||
container_name: explorer_service
|
||||
environment:
|
||||
INDEXER_RPC_URL: ${INDEXER_RPC_URL:-http://localhost:8779}
|
||||
INDEXER_RPC_URL: ${INDEXER_RPC_URL:-http://host.docker.internal:8779}
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
||||
@ -1,41 +1,5 @@
|
||||
# Chef stage - uses pre-built cargo-chef image
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.94.0-slim-trixie AS chef
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libclang-dev \
|
||||
clang \
|
||||
cmake \
|
||||
ninja-build \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install r0vm
|
||||
# Use quick install for x86-64 (risczero provides binaries only for this linux platform)
|
||||
# Manual build for other platforms (including arm64 Linux)
|
||||
RUN ARCH=$(uname -m); \
|
||||
if [ "$ARCH" = "x86_64" ]; then \
|
||||
echo "Using quick install for $ARCH"; \
|
||||
curl -L https://risczero.com/install | bash; \
|
||||
export PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}"; \
|
||||
rzup install; \
|
||||
else \
|
||||
echo "Using manual build for $ARCH"; \
|
||||
git clone --depth 1 --branch release-3.0 https://github.com/risc0/risc0.git; \
|
||||
git clone --depth 1 --branch r0.1.91.1 https://github.com/risc0/rust.git; \
|
||||
cd /risc0; \
|
||||
cargo install --path rzup; \
|
||||
rzup build --path /rust rust --verbose; \
|
||||
cargo install --path risc0/cargo-risczero; \
|
||||
fi
|
||||
ENV PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}"
|
||||
RUN cp "$(which r0vm)" /usr/local/bin/r0vm
|
||||
RUN test -x /usr/local/bin/r0vm
|
||||
RUN r0vm --version
|
||||
# Chef stage
|
||||
FROM risc0_base AS chef
|
||||
|
||||
WORKDIR /indexer_service
|
||||
|
||||
@ -69,6 +33,11 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
|
||||
# Runtime stage - minimal image
|
||||
FROM debian:trixie-slim
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create non-root user for security
|
||||
RUN useradd -m -u 1000 -s /bin/bash indexer_service_user && \
|
||||
mkdir -p /indexer_service /etc/indexer_service /var/lib/indexer_service && \
|
||||
|
||||
@ -5,4 +5,4 @@
|
||||
"addr": "http://localhost:8080"
|
||||
},
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101"
|
||||
}
|
||||
}
|
||||
8
lez/indexer/service/configs/docker/indexer_config.json
Normal file
8
lez/indexer/service/configs/docker/indexer_config.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"home": ".",
|
||||
"consensus_info_polling_interval": "1s",
|
||||
"bedrock_config": {
|
||||
"addr": "http://host.docker.internal:8080"
|
||||
},
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101"
|
||||
}
|
||||
@ -1,15 +1,26 @@
|
||||
services:
|
||||
# Build-only: shared base image (toolchain + r0vm) referenced as the
|
||||
# `risc0_base` named context below. It has no long-running command, so it
|
||||
# only gets built — it exits immediately if started.
|
||||
risc0_base:
|
||||
image: lez/risc0_base
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: lez/docker/risc0-base.Dockerfile
|
||||
|
||||
indexer_service:
|
||||
image: lez/indexer_service
|
||||
build:
|
||||
context: ../..
|
||||
context: ../../..
|
||||
dockerfile: lez/indexer/service/Dockerfile
|
||||
additional_contexts:
|
||||
risc0_base: "service:risc0_base"
|
||||
container_name: indexer_service
|
||||
ports:
|
||||
- "8779:8779"
|
||||
volumes:
|
||||
# Mount configuration
|
||||
- ./configs/indexer_config.json:/etc/indexer_service/indexer_config.json
|
||||
- ./configs/docker/indexer_config.json:/etc/indexer_service/indexer_config.json
|
||||
# Mount data volume
|
||||
- indexer_data:/var/lib/indexer_service
|
||||
|
||||
|
||||
@ -1,41 +1,5 @@
|
||||
# Chef stage - uses pre-built cargo-chef image
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.94.0-slim-trixie AS chef
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
libclang-dev \
|
||||
clang \
|
||||
cmake \
|
||||
ninja-build \
|
||||
curl \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install r0vm
|
||||
# Use quick install for x86-64 (risczero provides binaries only for this linux platform)
|
||||
# Manual build for other platforms (including arm64 Linux)
|
||||
RUN ARCH=$(uname -m); \
|
||||
if [ "$ARCH" = "x86_64" ]; then \
|
||||
echo "Using quick install for $ARCH"; \
|
||||
curl -L https://risczero.com/install | bash; \
|
||||
export PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}"; \
|
||||
rzup install; \
|
||||
else \
|
||||
echo "Using manual build for $ARCH"; \
|
||||
git clone --depth 1 --branch release-3.0 https://github.com/risc0/risc0.git; \
|
||||
git clone --depth 1 --branch r0.1.91.0 https://github.com/risc0/rust.git; \
|
||||
cd /risc0; \
|
||||
cargo install --path rzup; \
|
||||
rzup build --path /rust rust --verbose; \
|
||||
cargo install --path risc0/cargo-risczero; \
|
||||
fi
|
||||
ENV PATH="/root/.cargo/bin:/root/.risc0/bin:${PATH}"
|
||||
RUN cp "$(which r0vm)" /usr/local/bin/r0vm
|
||||
RUN test -x /usr/local/bin/r0vm
|
||||
RUN r0vm --version
|
||||
# Chef stage
|
||||
FROM risc0_base AS chef
|
||||
|
||||
WORKDIR /sequencer_service
|
||||
|
||||
@ -81,16 +45,21 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry/index \
|
||||
# Runtime stage - minimal image
|
||||
FROM debian:trixie-slim
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Create non-root user for security
|
||||
RUN useradd -m -u 1000 -s /bin/bash sequencer_user && \
|
||||
RUN useradd -m -u 1000 -s /bin/bash sequencer_service_user && \
|
||||
mkdir -p /sequencer_service /etc/sequencer_service /var/lib/sequencer_service && \
|
||||
chown -R sequencer_user:sequencer_user /sequencer_service /etc/sequencer_service /var/lib/sequencer_service
|
||||
chown -R sequencer_service_user:sequencer_service_user /sequencer_service /etc/sequencer_service /var/lib/sequencer_service
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder --chown=sequencer_user:sequencer_user /usr/local/bin/sequencer_service /usr/local/bin/sequencer_service
|
||||
COPY --from=builder --chown=sequencer_service_user:sequencer_service_user /usr/local/bin/sequencer_service /usr/local/bin/sequencer_service
|
||||
|
||||
# Copy r0vm binary from builder
|
||||
COPY --from=builder --chown=sequencer_user:sequencer_user /usr/local/bin/r0vm /usr/local/bin/r0vm
|
||||
COPY --from=builder --chown=sequencer_service_user:sequencer_service_user /usr/local/bin/r0vm /usr/local/bin/r0vm
|
||||
|
||||
VOLUME /var/lib/sequencer_service
|
||||
|
||||
@ -103,7 +72,7 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{ \
|
||||
\"jsonrpc\": \"2.0\", \
|
||||
\"method\": \"hello\", \
|
||||
\"method\": \"checkHealth\", \
|
||||
\"params\": {}, \
|
||||
\"id\": 1 \
|
||||
}" || exit 1
|
||||
@ -114,7 +83,7 @@ ENV RUST_LOG=info
|
||||
# Set explicit location for r0vm binary
|
||||
ENV RISC0_SERVER_PATH=/usr/local/bin/r0vm
|
||||
|
||||
USER sequencer_user
|
||||
USER sequencer_service_user
|
||||
|
||||
WORKDIR /sequencer_service
|
||||
CMD ["sequencer_service", "/etc/sequencer_service/sequencer_config.json"]
|
||||
|
||||
@ -11,9 +11,8 @@
|
||||
"max_retries": 5
|
||||
},
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
"node_url": "http://localhost:8080"
|
||||
"node_url": "http://localhost:18080"
|
||||
},
|
||||
"indexer_rpc_url": "ws://localhost:8779",
|
||||
"genesis": [
|
||||
{
|
||||
"supply_bridge_account": {
|
||||
|
||||
@ -11,9 +11,8 @@
|
||||
"max_retries": 5
|
||||
},
|
||||
"channel_id": "0101010101010101010101010101010101010101010101010101010101010101",
|
||||
"node_url": "http://localhost:18080"
|
||||
"node_url": "http://host.docker.internal:18080"
|
||||
},
|
||||
"indexer_rpc_url": "ws://localhost:8779",
|
||||
"genesis": [
|
||||
{
|
||||
"supply_bridge_account": {
|
||||
|
||||
@ -1,9 +1,20 @@
|
||||
services:
|
||||
# Build-only: shared base image (toolchain + r0vm) referenced as the
|
||||
# `risc0_base` named context below. It has no long-running command, so it
|
||||
# only gets built — it exits immediately if started.
|
||||
risc0_base:
|
||||
image: lez/risc0_base
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: lez/docker/risc0-base.Dockerfile
|
||||
|
||||
sequencer_service:
|
||||
image: lez/sequencer_service
|
||||
build:
|
||||
context: ../..
|
||||
context: ../../..
|
||||
dockerfile: lez/sequencer/service/Dockerfile
|
||||
additional_contexts:
|
||||
risc0_base: "service:risc0_base"
|
||||
container_name: sequencer_service
|
||||
ports:
|
||||
- "3040:3040"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user