Fixes the de-32 build break introduced by vibe-node #2912 (galileo 3.0.3 -> 3.0.8, merged as bc4cecf). Job ad580587: #16 chmod: cannot access '/0g/bin/0gchaind': No such file or directory The Dockerfile hardcoded 'galileo -> mv <root>/rpc /0g'. That held for 3.0.3, where every profile dir carried its own copy of the binaries. 3.0.8 DEDUPLICATED them into a shared <root>/bin/ (168 MB -> 69 MB), leaving rpc/ as configs-only — so the move produced configs and no binaries, and the build died two layers later on a chmod. Note 'does <root>/rpc exist' is not a sufficient test: 3.0.8 still ships rpc/, it just no longer holds bin/. Verified layouts: galileo 3.0.3 <root>/{rpc,validator,archive,seed}/bin/ + configs galileo 3.0.8 <root>/bin/ shared + <root>/{rpc,...}/ configs aristotle 1.0.6 <root>/bin/ + configs, no profile dirs So: take configs from the profile dir when present, then top the binaries up from the shared root bin/ if the profile dir did not supply them. Also asserts both binaries exist immediately after extraction, naming the chain, the version and the known layouts — so the next upstream reshuffle reports itself at the point of failure rather than as an anonymous chmod error. Verified against the real artifacts — all three now yield an identical /0g (bin/0gchaind 76M, bin/geth 46M, geth-config.toml, geth-genesis.json, kzg-trusted-setup.json, 0g-home/, rollback_cl.sh), and a synthetic unknown layout exits 1 with the diagnostic instead of reaching chmod. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
100 lines
4.6 KiB
Docker
100 lines
4.6 KiB
Docker
|
|
FROM rockylinux:9
|
|
|
|
COPY ./scripts/init.sh /usr/local/bin/init.sh
|
|
RUN chmod +x /usr/local/bin/init.sh
|
|
|
|
#RUN yum install -y curl tar gzip && yum clean all
|
|
|
|
ARG ZERO_GRAVITY_VERSION
|
|
ARG ZERO_GRAVITY_CHAIN_SPEC
|
|
|
|
# 0G publishes each network from a DIFFERENT repository, and the release-tag format is not
|
|
# consistent within either of them. The asset filename is always "<spec>-v<version>.tar.gz";
|
|
# only the tag varies:
|
|
#
|
|
# aristotle -> 0gchain-Aristotle 1.0.4 = "1.0.4" 1.0.6 = "v1.0.6"
|
|
# galileo -> 0gchain-NG 3.0.3 = "v3.0.3" 3.0.7 = "galileo-v3.0.7" 3.0.8 = "v3.0.8"
|
|
#
|
|
# So the tag cannot be hardcoded. Resolve it by trying the known forms in order and taking
|
|
# the first that actually yields the asset.
|
|
#
|
|
# curl uses -f (fail on HTTP error). Without it a 404 HTML body is written into the .tar.gz
|
|
# and the build dies several layers later at "tar: not in gzip format" -- an error that
|
|
# points nowhere near the real cause. That has cost three separate misdiagnoses.
|
|
RUN set -eu; \
|
|
ASSET="${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}.tar.gz"; \
|
|
if [ "${ZERO_GRAVITY_CHAIN_SPEC}" = "aristotle" ]; then \
|
|
REPO="0gfoundation/0gchain-Aristotle"; \
|
|
TAGS="${ZERO_GRAVITY_VERSION} v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \
|
|
else \
|
|
REPO="0gfoundation/0gchain-NG"; \
|
|
TAGS="v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION} ${ZERO_GRAVITY_VERSION}"; \
|
|
fi; \
|
|
for TAG in ${TAGS}; do \
|
|
URL="https://github.com/${REPO}/releases/download/${TAG}/${ASSET}"; \
|
|
echo "0g: trying tag '${TAG}' -> ${URL}"; \
|
|
if curl -fsSL "${URL}" -o "/tmp/${ASSET}"; then \
|
|
echo "0g: resolved ${ZERO_GRAVITY_CHAIN_SPEC} ${ZERO_GRAVITY_VERSION} from tag '${TAG}'"; \
|
|
break; \
|
|
fi; \
|
|
rm -f "/tmp/${ASSET}"; \
|
|
done; \
|
|
if [ ! -s "/tmp/${ASSET}" ]; then \
|
|
echo "0g: FATAL - no release asset '${ASSET}' found in ${REPO} under any of: ${TAGS}" >&2; \
|
|
echo "0g: aristotle and galileo are SEPARATE repos on SEPARATE version lines" >&2; \
|
|
echo "0g: aristotle = 0gchain-Aristotle (1.0.x), galileo = 0gchain-NG (3.0.x)" >&2; \
|
|
echo "0g: check that version '${ZERO_GRAVITY_VERSION}' exists for '${ZERO_GRAVITY_CHAIN_SPEC}'" >&2; \
|
|
exit 1; \
|
|
fi
|
|
|
|
# Extract by DETECTING the layout rather than assuming one per chain. 0G has shipped
|
|
# three shapes so far and changed between them without notice:
|
|
#
|
|
# galileo <= 3.0.3 <root>/{rpc,validator,archive,seed}/bin/ + configs (168 MB)
|
|
# -> binaries duplicated inside every profile dir
|
|
# galileo >= 3.0.8 <root>/bin/ shared, + <root>/{rpc,...}/ configs (69 MB)
|
|
# -> binaries DEDUPLICATED to the tarball root; rpc/ is configs-only
|
|
# aristotle 1.0.x <root>/bin/ + configs, no profile dirs at all
|
|
#
|
|
# So "does <root>/rpc exist" is NOT sufficient: 3.0.8 still has rpc/, it just no longer
|
|
# holds bin/. Take configs from the profile dir when present, then top the binaries up
|
|
# from the shared root bin/ if the profile dir didn't supply them.
|
|
#
|
|
# The old code hardcoded "galileo -> mv <root>/rpc /0g", so 3.0.8 yielded configs but no
|
|
# binaries and the build died two layers later at
|
|
# `chmod: cannot access '/0g/bin/0gchaind'` — an error naming neither the chain, the
|
|
# version, nor the layout. Assert on the binaries here so the NEXT upstream reshuffle
|
|
# reports itself at the point of failure instead.
|
|
RUN set -eu; \
|
|
SRC="/tmp/${ZERO_GRAVITY_CHAIN_SPEC}-v${ZERO_GRAVITY_VERSION}"; \
|
|
tar -xzf "${SRC}.tar.gz" -C /tmp; \
|
|
mkdir -p /0g; \
|
|
if [ -d "${SRC}/rpc" ]; then \
|
|
echo "0g: profile dir found -> ${SRC}/rpc"; \
|
|
cp -a "${SRC}/rpc/." /0g/; \
|
|
else \
|
|
echo "0g: no profile dir -> using tarball root ${SRC}"; \
|
|
cp -a "${SRC}/." /0g/; \
|
|
fi; \
|
|
if [ ! -f /0g/bin/0gchaind ] && [ -d "${SRC}/bin" ]; then \
|
|
echo "0g: binaries not in the profile dir -> topping up from ${SRC}/bin"; \
|
|
cp -a "${SRC}/bin" /0g/; \
|
|
fi; \
|
|
rm -rf "${SRC}"; \
|
|
missing=""; \
|
|
for b in 0gchaind geth; do \
|
|
[ -f "/0g/bin/${b}" ] || missing="${missing} bin/${b}"; \
|
|
done; \
|
|
if [ -n "${missing}" ]; then \
|
|
echo "0g: FATAL - missing after extraction:${missing}" >&2; \
|
|
echo "0g: ${ZERO_GRAVITY_CHAIN_SPEC} v${ZERO_GRAVITY_VERSION} tarball layout not recognised." >&2; \
|
|
echo "0g: known layouts are '<root>/rpc/bin/' (per-profile) and '<root>/bin/' (flat)." >&2; \
|
|
echo "0g: contents of /0g were:" >&2; \
|
|
ls -la /0g >&2 || true; \
|
|
exit 1; \
|
|
fi; \
|
|
chmod +x /0g/bin/0gchaind /0g/bin/geth
|
|
|
|
ENTRYPOINT [ "init.sh" ]
|