Skip to content

Commit

Permalink
feat: fix env vars + update site metadata (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
parketh authored Oct 28, 2024
1 parent 0a8c999 commit 3d96ccc
Show file tree
Hide file tree
Showing 34 changed files with 110 additions and 2,351 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
NEXT_PUBLIC_FINALITY_GADGET_API_URL=http://localhost:8080
NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=true
NEXT_PUBLIC_FINALITY_GADGET_API_URL=http://localhost:8080
28 changes: 23 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,26 @@ on:
- "**"

jobs:
lint_test:
uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@v0.3.0
with:
run-build: true
run-unit-tests: true
build_lint_format:
runs-on: ubuntu-24.04

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}

- name: Install dependencies
run: npm install

- name: Run lint
run: npm run lint

- name: Run format
run: npm run format

- name: Run build
run: npm run build
37 changes: 3 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,9 @@ COPY next.config.mjs .
COPY tsconfig.json .
COPY tailwind.config.ts .
COPY postcss.config.js .
COPY .env.example ./.env
# Replace the variables in the .env file
ARG NEXT_PUBLIC_FINALITY_GADGET_API_URL
ARG NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES
RUN sed -i "s|NEXT_PUBLIC_FINALITY_GADGET_API_URL=.*|NEXT_PUBLIC_FINALITY_GADGET_API_URL=${NEXT_PUBLIC_FINALITY_GADGET_API_URL}|g" .env
RUN sed -i "s|NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=.*|NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=${NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES}|g" .env

RUN npm run build
EXPOSE 13000

# Step 2. Production image, copy all the files and run next
FROM node:22-alpine3.19 AS runner
COPY entrypoint.sh .

WORKDIR /app

# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

# Copy the .env file
COPY --from=builder --chown=nextjs:nodejs /app/.env ./.env

RUN chown -R nextjs:nodejs .

USER nextjs

# Uncomment the following line to disable telemetry at run time
ENV NEXT_TELEMETRY_DISABLED=1

CMD ["node", "server.js"]
STOPSIGNAL SIGTERM
ENTRYPOINT ["./entrypoint.sh"]
169 changes: 0 additions & 169 deletions LICENSE

This file was deleted.

13 changes: 0 additions & 13 deletions Makefile

This file was deleted.

10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Babylon Finality Explorer
# Finality Explorer

A simple web application to allow users of OP Stack L2 chains to view the finality status of transactions.
A simple web application to allow users of OP Stack L2 chains that use the Babylon Bitcoin Staking Finality Gadget to view the finality status of transactions.

## Develop

Expand All @@ -11,11 +11,7 @@ variables in the `.env.example` file in the root directory:
cp .env.example .env.local
```

where,

- `NEXT_PUBLIC_FINALITY_GADGET_API_URL` specifies the back-end API for the finality gadget
- `NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES` boolean value to indicate whether display
testing network related message. Default to true
where `NEXT_PUBLIC_FINALITY_GADGET_API_URL` specifies the back-end API for the finality gadget.

Then, to start a development server:

Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ services:
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_FINALITY_GADGET_API_URL=${NEXT_PUBLIC_FINALITY_GADGET_API_URL}
- NEXT_PUBLIC_DISPLAY_TESTING_MESSAGES=true
image: snapchain/finality-explorer:latest
ports:
- "13000:3000"
environment:
- NODE_ENV=production
- NEXT_TELEMETRY_DISABLED=1
- NEXT_PUBLIC_FINALITY_GADGET_API_URL=${NEXT_PUBLIC_FINALITY_GADGET_API_URL}
env_file:
- .env
Expand Down
7 changes: 7 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Build the app
npm run build

# Start the app
exec npm run start
Binary file added public/favicon.ico
Binary file not shown.
Binary file added public/logo-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/og.png
Binary file not shown.
12 changes: 0 additions & 12 deletions src/app/assets/bg-pattern.svg

This file was deleted.

10 changes: 0 additions & 10 deletions src/app/assets/icon-black.svg

This file was deleted.

10 changes: 0 additions & 10 deletions src/app/assets/icon-white.svg

This file was deleted.

Loading

0 comments on commit 3d96ccc

Please sign in to comment.