feat: add Docker configuration and health check endpoint while updating analytics filtering and build types
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# Dependencies
|
||||
node_modules
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Next.js
|
||||
.next
|
||||
out
|
||||
dist
|
||||
build
|
||||
|
||||
# Environment files (will be injected at runtime)
|
||||
.env*
|
||||
!.env.example
|
||||
|
||||
# Version control
|
||||
.git
|
||||
.gitattributes
|
||||
|
||||
# IDE
|
||||
.vscode
|
||||
.idea
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
|
||||
# Python (legacy)
|
||||
__pycache__
|
||||
*.py
|
||||
*.pyw
|
||||
requirements.txt
|
||||
|
||||
# Docs & Scripts
|
||||
docs
|
||||
*.md
|
||||
!README.md
|
||||
*.bat
|
||||
ROADMAP.md
|
||||
|
||||
# Supabase (not needed in Docker image)
|
||||
supabase
|
||||
|
||||
# Artifacts / Gemini
|
||||
.artifacts
|
||||
.gemini
|
||||
+7
-4
@@ -1,11 +1,14 @@
|
||||
# Supabase Configuration
|
||||
# ─── Supabase (Zorunlu) ───────────────────────────────────────
|
||||
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
|
||||
|
||||
# AI Providers (Optional - These can also be set inside the app per user)
|
||||
# Müşteri Portalı hesabı oluşturmak için gerekli (Freelancer panelinde kullanılır)
|
||||
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
|
||||
|
||||
# ─── AI Sağlayıcılar (Opsiyonel — uygulama içi ayarlardan da tanımlanabilir) ───
|
||||
# OPENAI_API_KEY=your_openai_api_key
|
||||
# GROQ_API_KEY=your_groq_api_key
|
||||
# GEMINI_API_KEY=your_gemini_api_key
|
||||
|
||||
# Supabase Auth Configuration (For local / custom host)
|
||||
# NEXT_PUBLIC_SITE_URL=http://localhost:3000
|
||||
# ─── Supabase Auth (Self-host'ta gerekli olabilir) ───────────
|
||||
# NEXT_PUBLIC_SITE_URL=https://cognis.example.com
|
||||
|
||||
+22
-10
@@ -1,31 +1,37 @@
|
||||
# Production Dockerfile
|
||||
# ── Production Dockerfile (Dokploy / Coolify ready) ──────────────
|
||||
FROM node:20-alpine AS base
|
||||
|
||||
# Install dependencies only when needed
|
||||
# ── 1. Install dependencies ─────────────────────────────────────
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
WORKDIR /app
|
||||
|
||||
# Install pnpm
|
||||
RUN corepack enable pnpm
|
||||
|
||||
COPY package.json pnpm-lock.yaml* ./
|
||||
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml* ./
|
||||
RUN pnpm i --frozen-lockfile
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
# ── 2. Build ─────────────────────────────────────────────────────
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
RUN corepack enable pnpm
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
# Environment variables must be present at build time
|
||||
# Disable telemetry during build
|
||||
# Next.js inlines NEXT_PUBLIC_* at build time.
|
||||
# Dokploy / Coolify inject these as build-args automatically.
|
||||
ARG NEXT_PUBLIC_SUPABASE_URL
|
||||
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
ARG NEXT_PUBLIC_SITE_URL
|
||||
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
|
||||
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
RUN pnpm build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
# ── 3. Production runner ─────────────────────────────────────────
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
@@ -35,10 +41,10 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
||||
RUN addgroup --system --gid 1001 nodejs
|
||||
RUN adduser --system --uid 1001 nextjs
|
||||
|
||||
# Copy public assets
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
# Copy standalone output (Next.js output: "standalone")
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
@@ -48,4 +54,10 @@ EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Health check for Dokploy / Coolify / Docker orchestrators
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \
|
||||
CMD wget -qO- http://localhost:3000/api/health || exit 1
|
||||
|
||||
# Runtime env vars (Supabase keys, AI keys etc.) are injected by
|
||||
# Dokploy / Coolify as environment variables — no .env file needed.
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
+7
-4
@@ -1,18 +1,21 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
cognis-web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||||
NEXT_PUBLIC_SITE_URL: ${NEXT_PUBLIC_SITE_URL:-http://localhost:3000}
|
||||
container_name: cognis-web
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
# Supabase URL and Anon Key must be provided either here or via an .env file
|
||||
- NEXT_PUBLIC_SUPABASE_URL=${NEXT_PUBLIC_SUPABASE_URL}
|
||||
- NEXT_PUBLIC_SUPABASE_ANON_KEY=${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||||
- SUPABASE_SERVICE_ROLE_KEY=${SUPABASE_SERVICE_ROLE_KEY}
|
||||
- NEXT_PUBLIC_SITE_URL=${NEXT_PUBLIC_SITE_URL:-http://localhost:3000}
|
||||
env_file:
|
||||
- .env.local # Uses your local variables if present
|
||||
- .env.local
|
||||
|
||||
Reference in New Issue
Block a user