feat: update Docker configuration for improved performance and add local environment example
This commit is contained in:
@@ -3,8 +3,9 @@ node_modules
|
||||
.turbo
|
||||
**/.turbo
|
||||
.git
|
||||
*.md
|
||||
.env*
|
||||
!.env.example
|
||||
!.env.local.example
|
||||
.DS_Store
|
||||
apps/e2e
|
||||
apps/dev-tool
|
||||
@@ -16,3 +17,6 @@ apps/dev-tool
|
||||
.github
|
||||
docs
|
||||
**/*.tsbuildinfo
|
||||
**/*.md
|
||||
!**/AGENTS.md
|
||||
!**/CLAUDE.md
|
||||
|
||||
19
.env.local.example
Normal file
19
.env.local.example
Normal file
@@ -0,0 +1,19 @@
|
||||
# =====================================================
|
||||
# MyEasyCMS v2 — Local Development Environment
|
||||
# Copy to .env and run: docker compose -f docker-compose.local.yml up -d
|
||||
# =====================================================
|
||||
|
||||
# --- Database ---
|
||||
POSTGRES_PASSWORD=postgres
|
||||
|
||||
# --- Supabase Auth ---
|
||||
JWT_SECRET=super-secret-jwt-token-with-at-least-32-characters-long
|
||||
|
||||
# --- Supabase Keys (demo keys — safe for local dev only) ---
|
||||
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
|
||||
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
|
||||
|
||||
# --- Stripe (test keys) ---
|
||||
# Get your own test keys from https://dashboard.stripe.com/test/apikeys
|
||||
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_YOUR_KEY
|
||||
STRIPE_SECRET_KEY=sk_test_YOUR_KEY
|
||||
22
Dockerfile
22
Dockerfile
@@ -1,18 +1,15 @@
|
||||
FROM node:22-alpine AS base
|
||||
# node:22-slim (Debian/glibc) is ~2x faster for Next.js builds vs Alpine/musl
|
||||
FROM node:22-slim AS base
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
WORKDIR /app
|
||||
|
||||
# --- Install + Build in one stage ---
|
||||
# --- Install + Build ---
|
||||
FROM base AS builder
|
||||
# CACHE_BUST: change this value to force a full rebuild (busts Docker layer cache)
|
||||
ARG CACHE_BUST=14
|
||||
RUN echo "Cache bust: ${CACHE_BUST}"
|
||||
COPY . .
|
||||
RUN pnpm install --no-frozen-lockfile
|
||||
RUN --mount=type=cache,id=pnpm,target=/root/.local/share/pnpm/store \
|
||||
pnpm install --no-frozen-lockfile --prefer-offline
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# NEXT_PUBLIC_* vars are baked into the Next.js build at compile time.
|
||||
# Pass them as build args so the same Dockerfile works for any environment.
|
||||
ARG NEXT_PUBLIC_CI=false
|
||||
ARG NEXT_PUBLIC_SITE_URL=https://myeasycms.de
|
||||
ARG NEXT_PUBLIC_SUPABASE_URL=http://localhost:8000
|
||||
@@ -35,17 +32,16 @@ ENV NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=${NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}
|
||||
ENV NEXT_PUBLIC_BILLING_PROVIDER=${NEXT_PUBLIC_BILLING_PROVIDER}
|
||||
RUN pnpm --filter web build
|
||||
|
||||
# --- Run ---
|
||||
FROM base AS runner
|
||||
# --- Run (slim for smaller image than full Debian) ---
|
||||
FROM node:22-slim AS runner
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
COPY --from=builder /app/ ./
|
||||
|
||||
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
|
||||
|
||||
# Ensure Next.js cache directories are writable by the nextjs user
|
||||
RUN groupadd --system --gid 1001 nodejs && useradd --system --uid 1001 nextjs
|
||||
RUN mkdir -p /app/apps/web/.next/cache && chown -R nextjs:nodejs /app/apps/web/.next/cache
|
||||
|
||||
USER nextjs
|
||||
|
||||
@@ -41,7 +41,6 @@ const INTERNAL_PACKAGES = [
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const config = {
|
||||
output: 'standalone',
|
||||
reactStrictMode: true,
|
||||
/** Enables hot reloading for local packages without a build step */
|
||||
transpilePackages: INTERNAL_PACKAGES,
|
||||
|
||||
@@ -18,7 +18,7 @@ services:
|
||||
image: supabase/postgres:15.8.1.060
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '54322:5432'
|
||||
- '54322:54322'
|
||||
volumes:
|
||||
- supabase-db-data:/var/lib/postgresql/data
|
||||
- ./docker/db/zzz-role-passwords.sh:/docker-entrypoint-initdb.d/zzz-role-passwords.sh:ro
|
||||
@@ -317,7 +317,6 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
# NEXT_PUBLIC_CI=true bypasses the HTTPS check during build
|
||||
NEXT_PUBLIC_CI: 'true'
|
||||
NEXT_PUBLIC_SITE_URL: http://localhost:3000
|
||||
NEXT_PUBLIC_SUPABASE_URL: http://localhost:8000
|
||||
|
||||
Reference in New Issue
Block a user