Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix env vars + update site metadata #9

Merged
merged 15 commits into from
Oct 28, 2024
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
39 changes: 6 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,13 @@ 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
COPY package.json .
COPY package-lock.json .

RUN npm run build
RUN npm install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think we need these 3 lines. they are duplicate with

COPY package.json package-lock.json ./
# Install dependencies with npm
RUN npm ci

above


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

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
COPY entrypoint.sh .

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.

6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 0 additions & 8 deletions src/app/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import Image from "next/image";

import { shouldDisplayTestingMsg } from "@/config";

import { Logo } from "../Logo/Logo";
import { TestingInfo } from "../TestingInfo/TestingInfo";
import { ThemeToggle } from "../ThemeToggle/ThemeToggle";

interface HeaderProps {}
Expand Down Expand Up @@ -31,11 +28,6 @@ export const Header: React.FC<HeaderProps> = () => {
</div>
</div>
</div>
{shouldDisplayTestingMsg() && (
<div className="container mx-auto flex w-full items-center p-6 pb-0">
<TestingInfo />
</div>
)}
</nav>
);
};
30 changes: 0 additions & 30 deletions src/app/components/Modals/Privacy/PrivacyModal.tsx

This file was deleted.

Loading
Loading