File tree Expand file tree Collapse file tree 7 files changed +122
-128
lines changed
Expand file tree Collapse file tree 7 files changed +122
-128
lines changed Original file line number Diff line number Diff line change 1+ node_modules
2+ .next
3+ out
4+ .git
5+ .gitignore
6+ Dockerfile *
7+ docker-compose * .yml
8+ npm-debug.log *
9+ yarn-debug.log *
10+ yarn-error.log *
11+ .pnpm-store
12+ .env *
13+ ** /* .tsbuildinfo
Original file line number Diff line number Diff line change 1+ # syntax=docker/dockerfile:1.7
2+
3+ # ---------- Base ----------
4+ FROM node:20-alpine AS base
5+ ENV PNPM_HOME="/pnpm"
6+ ENV PATH="$PNPM_HOME:$PATH"
7+ RUN corepack enable
8+ WORKDIR /app
9+
10+ # ---------- Deps (install with frozen lockfile) ----------
11+ FROM base AS deps
12+ RUN apk add --no-cache libc6-compat
13+ COPY package.json package-lock.json ./
14+ RUN npm ci
15+
16+ # ---------- Build ----------
17+ FROM base AS build
18+ ENV NEXT_TELEMETRY_DISABLED=1
19+ # Provide a safe default so NextAuth doesn't fail during build
20+ ENV NEXTAUTH_SECRET=dev_docker_build_secret
21+ RUN apk add --no-cache libc6-compat
22+ COPY --from=deps /app/node_modules ./node_modules
23+ COPY . .
24+ RUN npm run build
25+
26+ # ---------- Runtime ----------
27+ FROM node:20-alpine AS runner
28+ ENV NODE_ENV=production
29+ WORKDIR /app
30+
31+ # Non-root user
32+ RUN addgroup -S nextjs && adduser -S nextjs -G nextjs
33+
34+ # Copy standalone server
35+ COPY --from=build /app/.next/standalone ./
36+ COPY --from=build /app/.next/static ./.next/static
37+ COPY --from=build /app/public ./public
38+
39+ ENV PORT=3000
40+ ENV HOSTNAME=0.0.0.0
41+ EXPOSE 3000
42+ USER nextjs
43+
44+ CMD ["node" , "server.js" ]
Original file line number Diff line number Diff line change @@ -137,4 +137,33 @@ Contributions are welcome! Please open an issue or submit a pull request.
137137
138138## License
139139
140- MIT
140+ MIT
141+
142+ ## Docker
143+
144+ ### Development (hot reload)
145+ ``` bash
146+ # Build and start
147+ docker compose -f docker-compose.dev.yml up --build
148+ # Then open http://localhost:3000
149+ ```
150+ - Code changes on your host are reflected inside the container.
151+ - Uses bind mounts and ` npm run dev ` .
152+
153+ ### Production
154+ ``` bash
155+ # Build image and start
156+ docker compose up --build -d
157+ # Tail logs
158+ docker compose logs -f
159+ # Stop
160+ docker compose down
161+ ```
162+ Set required environment variables (can be .env file in project root):
163+ ``` bash
164+ NEXTAUTH_URL=http://localhost:3000
165+ NEXTAUTH_SECRET=replace_with_secure_random
166+ GITHUB_CLIENT_ID=your_client_id
167+ GITHUB_CLIENT_SECRET=your_client_secret
168+ ```
169+ The production image uses Next.js standalone output for a small runtime.
Original file line number Diff line number Diff line change 1+ services :
2+ web :
3+ image : node:20-alpine
4+ working_dir : /app
5+ command : sh -c "npm ci && npm run dev"
6+ ports :
7+ - " 3000:3000"
8+ environment :
9+ - NODE_ENV=development
10+ - NEXT_TELEMETRY_DISABLED=1
11+ - HOSTNAME=0.0.0.0
12+ volumes :
13+ - ./:/app
14+ - /app/node_modules
15+ - /app/.next
16+ restart : unless-stopped
Original file line number Diff line number Diff line change 1+ services :
2+ web :
3+ build :
4+ context : .
5+ dockerfile : Dockerfile
6+ target : runner
7+ image : githubmon:prod
8+ ports :
9+ - " 3000:3000"
10+ environment :
11+ - NODE_ENV=production
12+ - NEXT_TELEMETRY_DISABLED=1
13+ - HOSTNAME=0.0.0.0
14+ # Map your envs; you can also use an env_file
15+ - NEXTAUTH_URL=${NEXTAUTH_URL}
16+ - NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
17+ - GITHUB_CLIENT_ID=${GITHUB_CLIENT_ID}
18+ - GITHUB_CLIENT_SECRET=${GITHUB_CLIENT_SECRET}
19+ restart : unless-stopped
Original file line number Diff line number Diff line change 11'use client'
22
33import { useRouter } from 'next/navigation'
4- import { Badge } from '@/components/ui/badge'
54import { RateLimitWarning } from '@/components/common/RateLimitWarning'
65import { ThemeToggle } from '@/components/theme/ThemeToggle'
76import { useSearchStore } from '@/stores'
You can’t perform that action at this time.
0 commit comments