arc-testnet: Add snapshot-init service (defc6046) #30

Closed
claude wants to merge 1 commits from issue-848 into main
2 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
# One-shot Arc snapshot downloader for compose init containers.
# Wraps arc-snapshots with a shell entrypoint so operators can optionally
# override EL/CL snapshot URLs via environment variables.
ARG ARC_EXECUTION_IMAGE=docker.cloudsmith.io/circle/arc-network/arc-execution:0.7.2
FROM ${ARC_EXECUTION_IMAGE} AS arc-bin
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates libssl3 zlib1g \
&& rm -rf /var/lib/apt/lists/*
COPY --from=arc-bin /usr/local/bin/arc-snapshots /usr/local/bin/arc-snapshots
COPY scripts/snapshot-init.sh /usr/local/bin/snapshot-init.sh
RUN chmod +x /usr/local/bin/snapshot-init.sh
ENTRYPOINT ["/usr/local/bin/snapshot-init.sh"]

23
arc/scripts/snapshot-init.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
set -eu
CHAIN="${ARC_SNAPSHOT_CHAIN:-arc-testnet}"
EXEC_PATH="${ARC_SNAPSHOT_EXECUTION_PATH:-/data/execution}"
CONS_PATH="${ARC_SNAPSHOT_CONSENSUS_PATH:-/data/consensus}"
if [ -n "${ARC_SNAPSHOT_EXECUTION_URL:-}" ] && [ -n "${ARC_SNAPSHOT_CONSENSUS_URL:-}" ]; then
exec /usr/local/bin/arc-snapshots download \
--chain="${CHAIN}" \
--execution-path="${EXEC_PATH}" \
--consensus-path="${CONS_PATH}" \
--execution-url="${ARC_SNAPSHOT_EXECUTION_URL}" \
--consensus-url="${ARC_SNAPSHOT_CONSENSUS_URL}"
elif [ -n "${ARC_SNAPSHOT_EXECUTION_URL:-}" ] || [ -n "${ARC_SNAPSHOT_CONSENSUS_URL:-}" ]; then
echo "Both ARC_SNAPSHOT_EXECUTION_URL and ARC_SNAPSHOT_CONSENSUS_URL must be set together" >&2
exit 1
else
exec /usr/local/bin/arc-snapshots download \
--chain="${CHAIN}" \
--execution-path="${EXEC_PATH}" \
--consensus-path="${CONS_PATH}"
fi