mirror of
https://github.com/logos-blockchain/logos-blockchain-block-explorer-template.git
synced 2026-04-03 01:13:12 +00:00
Merge pull request #5 from logos-blockchain/docker-image
feat(docker): Docker image workflow and improvements
This commit is contained in:
commit
fb5b863e42
@ -10,7 +10,7 @@ on:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}-explorer
|
||||
IMAGE_NAME: logos-blockchain-explorer
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
@ -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
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user