Merge pull request #5 from logos-blockchain/docker-image

feat(docker): Docker image workflow and improvements
This commit is contained in:
gusto 2026-02-25 12:07:47 +02:00 committed by GitHub
commit fb5b863e42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 5 deletions

View File

@ -10,7 +10,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-explorer
IMAGE_NAME: logos-blockchain-explorer
jobs:
build-and-push:

View File

@ -6,8 +6,8 @@ from lifespan import lifespan
from router import create_router
def create_app() -> FastAPI:
app = NBE(lifespan=lifespan)
def create_app(root_path) -> FastAPI:
app = NBE(lifespan=lifespan, root_path=root_path)
app = mount_statics(app)
app.include_router(create_router())
return app

View File

@ -9,7 +9,8 @@ from logs import setup_logging
async def main():
app = create_app()
base_path = getenv("NBE_BASE_PATH", "").strip().rstrip("/")
app = create_app(base_path)
host = getenv("NBE_HOST", "0.0.0.0")
port = int(getenv("NBE_PORT", 8000))

View File

@ -9,6 +9,15 @@ import TransactionDetailPage from './pages/TransactionDetail.js';
const ROOT = document.getElementById('app');
// Detect the Base Path from the HTML <base> tag.
// If the tag is missing or equals "__BASE_PATH__", default to root "/".
const BASE_PATH = (() => {
const baseHref = document.querySelector('base')?.getAttribute('href');
if (!baseHref || baseHref === "__BASE_PATH__") return '/';
return baseHref.endsWith('/') ? baseHref : `${baseHref}/`;
})();
function LoadingScreen() {
return h('main', { class: 'wrap' }, h('p', null, 'Loading...'));
}
@ -47,7 +56,9 @@ function AppRouter() {
re: route.re,
view: route.view,
}));
return h(Router, { routes: wired });
// Pass the base prop to the Router so it knows where internal links start
return h(Router, { routes: wired, base: BASE_PATH });
}
try {