Files
glenloch-media/Dockerfile
T
Tiel Coder c595865496 A1: foundation scaffold (Next.js 15, shadcn/Radix, Drizzle+Postgres, Vitest, Docker)
- Next.js 15 + TS strict + Tailwind 4 + ESLint 9
- shadcn/ui initialized (Radix, CSS variables); cn() util
- Drizzle + postgres driver + Zod; db client + schema placeholder (A2)
- Vitest with passing cn() test; GitHub Actions CI
- Portable container stack: multi-stage non-root Dockerfile, docker-compose (app + Postgres on host 5433)
- Verified: typecheck, lint, test (3), build, docker build, HTTP 200 on :3000
- Records the 5 pre-build decisions (email-only launch, SMS deferred)
2026-11-17 18:09:24 +00:00

42 lines
1.4 KiB
Docker

# ---------------------------------------------------------------------------
# Media Team Hub — portable, containerized Next.js app.
# Multi-stage: build in an alpine/node image, run a lean runner image.
# The app is standard HTTP on :3000 — sit it behind your reverse proxy.
# ---------------------------------------------------------------------------
FROM node:22-alpine AS base
WORKDIR /app
ENV NODE_ENV=production
# pnpm is how this project is built (see package.json scripts).
RUN npm install -g pnpm@9.15.0
FROM base AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
# Frozen install — fails the build if the lockfile is out of sync.
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
# pnpm runs the app in production (see package.json scripts).
RUN npm install -g pnpm@9.15.0
# Run as a non-root user (busybox adduser/addgroup on alpine).
RUN addgroup -S nodegrp \
&& adduser -S -G nodegrp -H -D nextjs
# Build output, deps, static assets.
COPY --from=builder --chown=nextjs:nodegrp /app/public ./public
COPY --from=builder --chown=nextjs:nodegrp /app/node_modules ./node_modules
COPY --from=builder --chown=nextjs:nodegrp /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodegrp /app/.next ./.next
USER nextjs
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME=0.0.0.0
CMD ["pnpm", "start"]