Files
coreci 2ffc71cff9 feat(P04): codified docker release system — deploy.sh + Dockerfile + versioning
---ci---
phase: 4
milestone: v0.1
status: execute
persona: ci-lead-developer
task: T-4.2
requirements:
  covered: [REQ-52]
  partial: []
---/ci---

Codified release workflow for future releases: .ciagent/release/deploy.sh
(one-command tag-anchored deploy: gates at tag, worktree build, sync to
Docker host, image build, rolling container swap with researchx-prev
rollback, health check), frontend/Dockerfile (multi-stage, Next.js
standalone, non-root runtime), VERSIONING.md release rules, README.
Transport: sshpass OR native SSH_ASKPASS; rsync OR tar-over-ssh.
Version argument supports <tag>-uat variants staging milestone HEAD
(tag + review infra) without minting release tags — used for manual
UAT deployment while the owner approval gate stays closed. Secrets
(DEPLOY_HOST/USER/PASSWORD) resolve only from .ciagent/.env.secrets.
2026-09-27 02:33:12 +00:00

36 lines
1.0 KiB
Docker

# ResearchX frontend — production release image (ciagent release system)
# Multi-stage: deps -> build -> runtime. Next.js standalone output.
# Built ON the Docker host from the synced source (no local docker required).
# ---- deps ----
FROM node:22-alpine AS deps
RUN corepack enable
WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
RUN pnpm install --frozen-lockfile
# ---- build ----
FROM node:22-alpine AS build
RUN corepack enable
WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN pnpm build
# ---- runtime ----
FROM node:22-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production \
NEXT_TELEMETRY_DISABLED=1 \
PORT=3000 \
HOSTNAME=0.0.0.0
RUN addgroup -S researchx && adduser -S researchx -G researchx
# Standalone output: the server + minimal node_modules only.
COPY --from=build --chown=researchx:researchx /app/.next/standalone ./
COPY --from=build --chown=researchx:researchx /app/.next/static ./.next/static
USER researchx
EXPOSE 3000
CMD ["node", "server.js"]