feat(01-01): Next.js app + Docker Compose stack with network segmentation
- Next.js 15 app with Tailwind CSS v4, standalone output for Docker - Root layout with de locale, page with Tessera placeholder - Multi-stage Dockerfile for web with monorepo root context - Docker Compose with 4 services: traefik, web, api, db - Three segregated networks: frontend-net, backend-net, data-net (internal) - Traefik v2.11 reverse proxy routing / to web, /api to api - API strip prefix middleware for clean routing - PostgreSQL 16-alpine with health checks and named volume - Fixed API Dockerfile for pnpm monorepo node_modules structure - Fixed Next.js standalone path for monorepo (apps/web/server.js) - Fixed Traefik Docker API version compatibility - Network segmentation: web NOT on data-net, api NOT on frontend-net
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
FROM node:24-alpine AS base
|
||||
RUN corepack enable && corepack prepare pnpm@9 --activate
|
||||
|
||||
FROM base AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||
COPY apps/web/package.json ./apps/web/
|
||||
COPY packages/shared/package.json ./packages/shared/
|
||||
RUN pnpm install --frozen-lockfile --filter=@tessera/web...
|
||||
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
COPY --from=deps /app/ ./
|
||||
COPY apps/web/ ./apps/web/
|
||||
COPY packages/shared/ ./packages/shared/
|
||||
COPY tsconfig.base.json ./
|
||||
RUN pnpm --filter=@tessera/web build
|
||||
|
||||
FROM node:24-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
COPY --from=builder /app/apps/web/public ./apps/web/public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/apps/web/.next/static ./apps/web/.next/static
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
CMD ["node", "apps/web/server.js"]
|
||||
Reference in New Issue
Block a user