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
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
reactStrictMode: true,
typedRoutes: true,
images: {
Expand Down
50 changes: 43 additions & 7 deletions ops/docker/Dockerfile.web
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FROM node:24-alpine
FROM node:24-alpine AS base

# Install libc6-compat for Alpine compatibility
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Enable pnpm via corepack
RUN corepack enable

# Copy dependency manifests first for layer caching
# ─── 1. Dependencies Stage ─────────────────────────────────────
FROM base AS deps

# Copy dependency manifests
COPY package.json pnpm-lock.yaml ./

# Configure workspace policy for native dependencies if required
Expand All @@ -14,15 +19,46 @@ RUN printf "packages:\n - '.'\n\nallowBuilds:\n esbuild: true\n sharp: true\n
# Install dependencies using frozen lockfile
RUN pnpm install --frozen-lockfile

# Copy application source code
# ─── 2. Build Stage ───────────────────────────────────────────
FROM base AS builder

COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Build Next.js application
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production

# Build Next.js application with standalone output
RUN pnpm build

EXPOSE 3000
# ─── 3. Production Runner Stage ───────────────────────────────
FROM node:24-alpine AS runner

WORKDIR /app

ENV PORT=3000
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"

# Create a non-root system user for security
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs

# Copy static assets and public directory
COPY --from=builder --chown=nextjs:nodejs /app/public ./public

# Set correct permission for prerender cache
RUN mkdir .next && chown nextjs:nodejs .next

# 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

USER nextjs

EXPOSE 3000

CMD ["node", "server.js"]

CMD ["pnpm", "start"]
16 changes: 8 additions & 8 deletions ops/docker/Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ WORKDIR /app
# Enable pnpm via corepack
RUN corepack enable

# Install Supercronic cron runner (cached layer)
RUN wget -O /usr/local/bin/supercronic \
https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64 \
&& chmod +x /usr/local/bin/supercronic

# Copy dependency manifests first for layer caching
COPY package.json pnpm-lock.yaml ./

Expand All @@ -14,19 +19,14 @@ RUN printf "packages:\n - '.'\n\nallowBuilds:\n esbuild: true\n sharp: true\n
# Install dependencies using frozen lockfile
RUN pnpm install --frozen-lockfile

# Copy application source code
COPY . .

# Install Supercronic cron runner
RUN wget -O /usr/local/bin/supercronic \
https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64 \
&& chmod +x /usr/local/bin/supercronic

# Copy entrypoint script and initial leaderboard cron job definition
COPY ops/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
COPY ops/cron/leaderboard.cron /etc/leaderboard.cron
RUN chmod +x /usr/local/bin/entrypoint.sh

# Copy application source code
COPY . .

# Build-time argument for version identification
ARG GIT_COMMIT_SHA=development
ENV DEVIMPACT_VERSION=${GIT_COMMIT_SHA}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"radix-ui": "^1.4.3",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"react-icons": "^5.6.0",
"recharts": "^2.12.7",
"redis": "^5.12.1",
"tailwind-merge": "^2.5.3"
Expand Down
Loading
Loading