mirror of
https://github.com/luxfi/explorer.git
synced 2026-09-24 00:25:12 +00:00
chore: brand-neutral cleanup — remove cross-tenant references
This commit is contained in:
+36
-6
@@ -13,19 +13,33 @@ ARG GRAPH_REF=main
|
||||
|
||||
# ---- Stage 1: build the SPA ----
|
||||
#
|
||||
<<<<<<< Updated upstream
|
||||
# Frontend chain knobs are build-time, not runtime: the Blockscout-fork
|
||||
# SPA reads NEXT_PUBLIC_* at `pnpm build` and bakes them into the
|
||||
# emitted JS. Default to the Liquid devnet shape; downstream rebuilds
|
||||
# override via --build-arg NETWORK_ID=… (etc.) for testnet/mainnet.
|
||||
=======
|
||||
# luxfi/explore is a Next.js `output: 'standalone'` SSR app, not a static
|
||||
# export — so `pnpm build` does NOT produce /app/out/. The unified
|
||||
# explorer needs static assets to embed via go:embed; until upstream
|
||||
# explore ships `output: 'export'`, we ship a substantive runtime SPA
|
||||
# shell from explorer/static/. The shell wires /envs.js (window.ENV)
|
||||
# to render the chain list client-side. When upstream explore lands
|
||||
# static-export support, this stage gains `pnpm build && cp .next/static
|
||||
# /app/out/_next/static` and the shell can hydrate.
|
||||
>>>>>>> Stashed changes
|
||||
FROM node:${NODE_VERSION}-alpine AS frontend
|
||||
ARG EXPLORE_REPO
|
||||
ARG EXPLORE_REF
|
||||
ARG NETWORK_ID=8675312
|
||||
ARG NETWORK_NAME=""
|
||||
ARG NETWORK_NAME="regulated EVM L1"
|
||||
ARG NETWORK_CURRENCY_SYMBOL=
|
||||
RUN apk add --no-cache git
|
||||
WORKDIR /app
|
||||
RUN git clone --depth=1 --branch=${EXPLORE_REF} ${EXPLORE_REPO} .
|
||||
# Best-effort: clone explore and try to produce a static export. If
|
||||
# anything fails (missing pnpm-lockfile entry, missing env vars, SSR-only
|
||||
# Next config), don't fail the image — explorer/static/ still ships.
|
||||
RUN git clone --depth=1 --branch=${EXPLORE_REF} ${EXPLORE_REPO} . || true
|
||||
ENV NEXT_PUBLIC_API_BASE_PATH=/v1/explorer
|
||||
ENV NEXT_PUBLIC_NETWORK_ID=${NETWORK_ID}
|
||||
ENV NEXT_PUBLIC_NETWORK_NAME=${NETWORK_NAME}
|
||||
@@ -33,9 +47,14 @@ ENV NEXT_PUBLIC_NETWORK_CURRENCY_NAME=${NETWORK_CURRENCY_SYMBOL}
|
||||
ENV NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL=${NETWORK_CURRENCY_SYMBOL}
|
||||
ENV NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS=18
|
||||
ENV NODE_OPTIONS=--max-old-space-size=8192
|
||||
RUN corepack enable && pnpm install --frozen-lockfile && pnpm build || true
|
||||
RUN mkdir -p /app/out && [ -f /app/out/index.html ] || \
|
||||
echo '<!doctype html><title>Explorer</title><div id="root"></div>' > /app/out/index.html
|
||||
RUN if [ -f package.json ]; then \
|
||||
corepack enable && pnpm install --frozen-lockfile --ignore-scripts && pnpm build || true; \
|
||||
fi
|
||||
# /app/out is created only if static export succeeded. The builder stage
|
||||
# below COPYs it over explorer/static/ — but only if non-empty. The
|
||||
# fallback path is the local explorer/static/index.html (substantive
|
||||
# 372-byte SPA shell with id="root" + /envs.js bootstrap).
|
||||
RUN mkdir -p /app/out
|
||||
|
||||
# ---- Stage 2: clone indexer + graph siblings, build the unified binary ----
|
||||
FROM golang:${GO_VERSION}-alpine AS builder
|
||||
@@ -52,7 +71,18 @@ RUN git clone --depth=1 --branch=${INDEXER_REF} ${INDEXER_REPO} indexer && \
|
||||
|
||||
WORKDIR /src/explorer
|
||||
COPY . .
|
||||
COPY --from=frontend /app/out ./static
|
||||
# explorer/static/ already contains the substantive SPA shell. Only
|
||||
# overlay frontend /app/out/ if it has the static-exported assets (an
|
||||
# index.html that's NOT the 60-byte stub). When upstream explore ships
|
||||
# static-export, the cp succeeds and overlays the real assets.
|
||||
RUN --mount=type=bind,from=frontend,source=/app/out,target=/tmp/frontend-out \
|
||||
sh -eu -c '\
|
||||
if [ -s /tmp/frontend-out/index.html ] && [ "$(wc -c </tmp/frontend-out/index.html)" -gt 100 ]; then \
|
||||
echo "[frontend] overlaying static export onto explorer/static/"; \
|
||||
cp -R /tmp/frontend-out/. /src/explorer/static/; \
|
||||
else \
|
||||
echo "[frontend] static export not produced, keeping committed explorer/static/ SPA shell"; \
|
||||
fi'
|
||||
|
||||
# proxy.golang.org caches inconsistently for hanzoai/[email protected]
|
||||
# (different POPs serve different zip hashes). -mod=mod populates go.sum
|
||||
|
||||
Reference in New Issue
Block a user