Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
.git
.next
.vscode
.idea
*.log
npm-debug.log*
.DS_Store
.env
README.md
Dockerfile*
.dockerignore
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
SSV_NETWORKS='[{"networkId":560048,"apiVersion":"v4","apiNetwork":"hoodi","api":"https://api.stage.ops.ssvlabsinternal.com/api","explorerUrl":"https://hoodi.explorer.ssv.network","insufficientBalanceUrl":"https://faucet.ssv.network","googleTagSecret":"GTM-K3GR7M5","tokenAddress":"0x9F5d4Ec84fC4785788aB44F9de973cF34F7A038e","setterContractAddress":"0x58410Bef803ECd7E63B23664C586A6DB72DAf59c","getterContractAddress":"0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe"}]'
NEXT_PUBLIC_SSV_NETWORKS='[{"networkId":560048,"apiVersion":"v4","apiNetwork":"hoodi","api":"https://api.stage.ops.ssvlabsinternal.com/api","explorerUrl":"https://hoodi.explorer.ssv.network","insufficientBalanceUrl":"https://faucet.ssv.network","googleTagSecret":"GTM-K3GR7M5","tokenAddress":"0x9F5d4Ec84fC4785788aB44F9de973cF34F7A038e","setterContractAddress":"0x58410Bef803ECd7E63B23664C586A6DB72DAf59c","getterContractAddress":"0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe"}]'
SITE_URL='http://localhost:3000'
47 changes: 18 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
FROM node:20-alpine AS builder
# Use an official Node.js runtime as a base image
FROM node:20.10-alpine

# Set working directory
WORKDIR /app
WORKDIR /usr/app

# Install dependencies early to leverage Docker cache
COPY package.json pnpm-lock.yaml* ./
RUN npm install -g pnpm && pnpm install
# Install PM2 globally
RUN npm install -g pnpm

# Copy rest of the app
COPY . .
COPY .env.example .env

# Build the Next.js app
RUN pnpm docker-build

FROM node:20-alpine AS runner
# Copy package files for dependency installation
# Utilise Docker cache to save re-installing dependencies if unchanged
COPY ./package*.json ./pnpm-lock.yaml ./

WORKDIR /app
# Install dependencies
RUN pnpm install

# Copy all files
COPY ./ ./
COPY .env.example .env

# Only copy necessary files from builder
RUN mkdir /app/src
COPY --from=builder /app/package.json ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/tsconfig.json ./
COPY --from=builder /app/src/env.js ./src/env.js

# Set environment variables (override in docker-compose or runtime)
ENV NODE_ENV=production
# Build app
RUN pnpm docker-build

# Expose port (default Next.js port)
# Expose the listening port
EXPOSE 3000

# Start the Next.js server
CMD ["node_modules/.bin/next", "start"]
# Launch app with PM2
CMD [ "pnpm", "start" ]
5 changes: 4 additions & 1 deletion src/config/site.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ export const siteConfig = {
name: "SSV Network Explorer",
description:
"Explore SSV Network | View key metrics, recent activity, and search for data.",
url: env.NODE_ENV === "development" ? "http://localhost:3000" : env.SITE_URL,
url:
env.NODE_ENV === "development" || !env.SITE_URL
? "http://localhost:3000"
: env.SITE_URL,
links: { github: "https://github.com/ssvlabs/ssv-explorer" },
}