feat: update Docker configuration for improved performance and add local environment example

This commit is contained in:
T. Zehetbauer
2026-04-03 09:37:36 +02:00
parent d4acc3ba22
commit 124c6a632a
5 changed files with 34 additions and 17 deletions

View File

@@ -3,8 +3,9 @@ node_modules
.turbo .turbo
**/.turbo **/.turbo
.git .git
*.md
.env* .env*
!.env.example
!.env.local.example
.DS_Store .DS_Store
apps/e2e apps/e2e
apps/dev-tool apps/dev-tool
@@ -16,3 +17,6 @@ apps/dev-tool
.github .github
docs docs
**/*.tsbuildinfo **/*.tsbuildinfo
**/*.md
!**/AGENTS.md
!**/CLAUDE.md

19
.env.local.example Normal file
View 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

View File

@@ -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 RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app WORKDIR /app
# --- Install + Build in one stage --- # --- Install + Build ---
FROM base AS builder 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 . . 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 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_CI=false
ARG NEXT_PUBLIC_SITE_URL=https://myeasycms.de ARG NEXT_PUBLIC_SITE_URL=https://myeasycms.de
ARG NEXT_PUBLIC_SUPABASE_URL=http://localhost:8000 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} ENV NEXT_PUBLIC_BILLING_PROVIDER=${NEXT_PUBLIC_BILLING_PROVIDER}
RUN pnpm --filter web build RUN pnpm --filter web build
# --- Run --- # --- Run (slim for smaller image than full Debian) ---
FROM base AS runner FROM node:22-slim AS runner
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/ ./ COPY --from=builder /app/ ./
RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs RUN groupadd --system --gid 1001 nodejs && useradd --system --uid 1001 nextjs
# Ensure Next.js cache directories are writable by the nextjs user
RUN mkdir -p /app/apps/web/.next/cache && chown -R nextjs:nodejs /app/apps/web/.next/cache RUN mkdir -p /app/apps/web/.next/cache && chown -R nextjs:nodejs /app/apps/web/.next/cache
USER nextjs USER nextjs

View File

@@ -41,7 +41,6 @@ const INTERNAL_PACKAGES = [
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const config = { const config = {
output: 'standalone',
reactStrictMode: true, reactStrictMode: true,
/** Enables hot reloading for local packages without a build step */ /** Enables hot reloading for local packages without a build step */
transpilePackages: INTERNAL_PACKAGES, transpilePackages: INTERNAL_PACKAGES,

View File

@@ -18,7 +18,7 @@ services:
image: supabase/postgres:15.8.1.060 image: supabase/postgres:15.8.1.060
restart: unless-stopped restart: unless-stopped
ports: ports:
- '54322:5432' - '54322:54322'
volumes: volumes:
- supabase-db-data:/var/lib/postgresql/data - supabase-db-data:/var/lib/postgresql/data
- ./docker/db/zzz-role-passwords.sh:/docker-entrypoint-initdb.d/zzz-role-passwords.sh:ro - ./docker/db/zzz-role-passwords.sh:/docker-entrypoint-initdb.d/zzz-role-passwords.sh:ro
@@ -317,7 +317,6 @@ services:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args: args:
# NEXT_PUBLIC_CI=true bypasses the HTTPS check during build
NEXT_PUBLIC_CI: 'true' NEXT_PUBLIC_CI: 'true'
NEXT_PUBLIC_SITE_URL: http://localhost:3000 NEXT_PUBLIC_SITE_URL: http://localhost:3000
NEXT_PUBLIC_SUPABASE_URL: http://localhost:8000 NEXT_PUBLIC_SUPABASE_URL: http://localhost:8000