9695b41646
Yarn install was taking ~82s (warm cache, no scripts). pnpm achieves ~7.5s for the same operation — an 11x speedup thanks to its content-addressable store and hard-linking. Key changes: - Add pnpm-workspace.yaml, .npmrc (shamefully-hoist for RN compat) - Replace yarn.lock with pnpm-lock.yaml (imported via pnpm import) - Use workspace:* protocol for @slopus/happy-wire cross-references - Move happy-cli resolutions to root pnpm.overrides - Add pnpm.onlyBuiltDependencies allowlist for native build scripts - Update all 3 Dockerfiles to use corepack + pnpm - Update CI workflows to use pnpm/action-setup@v4 - Update all scripts, tests, and docs referencing yarn Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
60 lines
2.1 KiB
Docker
60 lines
2.1 KiB
Docker
# Standalone happy-server: single container, no external dependencies
|
|
# Uses PGlite (embedded Postgres), local filesystem storage, no Redis
|
|
|
|
# Stage 1: install dependencies
|
|
FROM node:20 AS deps
|
|
|
|
RUN apt-get update && apt-get install -y python3 make g++ build-essential && rm -rf /var/lib/apt/lists/*
|
|
RUN corepack enable && corepack prepare pnpm@10.11.0 --activate
|
|
|
|
WORKDIR /repo
|
|
|
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
|
COPY scripts ./scripts
|
|
COPY patches ./patches
|
|
|
|
RUN mkdir -p packages/happy-app packages/happy-server packages/happy-cli packages/happy-agent packages/happy-wire
|
|
|
|
COPY packages/happy-app/package.json packages/happy-app/
|
|
COPY packages/happy-server/package.json packages/happy-server/
|
|
COPY packages/happy-cli/package.json packages/happy-cli/
|
|
COPY packages/happy-agent/package.json packages/happy-agent/
|
|
COPY packages/happy-wire/package.json packages/happy-wire/
|
|
|
|
# Workspace postinstall requirements
|
|
COPY packages/happy-app/patches packages/happy-app/patches
|
|
COPY packages/happy-server/prisma packages/happy-server/prisma
|
|
COPY packages/happy-cli/scripts packages/happy-cli/scripts
|
|
COPY packages/happy-cli/tools packages/happy-cli/tools
|
|
|
|
RUN SKIP_HAPPY_WIRE_BUILD=1 pnpm install --frozen-lockfile
|
|
|
|
# Stage 2: copy source and type-check
|
|
FROM deps AS builder
|
|
|
|
COPY packages/happy-wire ./packages/happy-wire
|
|
COPY packages/happy-server ./packages/happy-server
|
|
|
|
RUN pnpm --filter @slopus/happy-wire build
|
|
RUN pnpm --filter happy-server build
|
|
|
|
# Stage 3: runtime
|
|
FROM node:20-slim AS runner
|
|
|
|
WORKDIR /repo
|
|
|
|
RUN apt-get update && apt-get install -y ffmpeg curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
ENV NODE_ENV=production
|
|
ENV DATA_DIR=/data
|
|
ENV PGLITE_DIR=/data/pglite
|
|
|
|
COPY --from=builder /repo/node_modules /repo/node_modules
|
|
COPY --from=builder /repo/packages/happy-wire /repo/packages/happy-wire
|
|
COPY --from=builder /repo/packages/happy-server /repo/packages/happy-server
|
|
|
|
VOLUME /data
|
|
EXPOSE 3005
|
|
|
|
CMD ["sh", "-c", "node_modules/.bin/tsx packages/happy-server/sources/standalone.ts migrate && exec node_modules/.bin/tsx packages/happy-server/sources/standalone.ts serve"]
|