feat(deploy): aibook.fun deploy layer (terraform + ansible + docker on DO)
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
# aibook-fun — Next.js 16 marketing site (marketing-site/), standalone output.
|
||||
#
|
||||
# Build context = marketing-site/ (see .gitea/workflows/deploy.yml):
|
||||
# docker build -f deploy/docker/Dockerfile -t <image> marketing-site/
|
||||
#
|
||||
# Multi-stage: deps → build (next build → .next/standalone) → slim non-root runner.
|
||||
# Requires `output: 'standalone'` in next.config.mjs (added on this branch).
|
||||
# Node 20.9+ / 22+ required by Next 16; pin 22 LTS.
|
||||
|
||||
FROM node:22-alpine AS deps
|
||||
WORKDIR /app
|
||||
# Lockfiles first for layer caching.
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
# Next standalone ships as a single node server.js; run as non-root (uid 1001).
|
||||
RUN addgroup --system --gid 1001 nodejs \
|
||||
&& adduser --system --uid 1001 --ingroup nodejs nextjs
|
||||
|
||||
# Static assets not bundled into the standalone output.
|
||||
COPY --from=builder /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user