fix: gitignore .env.production + Docker build fixes (#868, #866)#911
fix: gitignore .env.production + Docker build fixes (#868, #866)#911chris-yyau wants to merge 2 commits intoslopus:mainfrom
Conversation
…us#866) 1. **.gitignore**: Add `.env.production` to prevent accidental commit of secrets like HANDY_MASTER_SECRET (slopus#868) 2. **Dockerfile**: Add missing `COPY patches ./patches` so postinstall.cjs can find `fix-pglite-prisma-bytes.cjs` during `yarn install` (slopus#866) 3. **standalone.ts**: Add `__dirname`-relative candidate for prisma/migrations path so the migration finder works regardless of WORKDIR (slopus#866) 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>
There was a problem hiding this comment.
Pull request overview
This PR applies small fixes to prevent production secrets from being committed, unblock standalone Docker builds that rely on repo-level patch scripts, and improve migration directory discovery in the happy-server standalone entrypoint.
Changes:
- Ignore
.env.productionin git to reduce risk of committing secrets. - Fix standalone Docker build by copying the repo
patches/directory into the image. - Add an additional
prisma/migrationslookup candidate intended to work whenWORKDIRdiffers (e.g., Docker).
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/happy-server/sources/standalone.ts |
Adds an additional migration directory candidate for non-packages/happy-server working directories. |
Dockerfile |
Copies patches/ so scripts/postinstall.cjs can load required patch modules during yarn install. |
.gitignore |
Ignores .env.production to prevent accidental secret commits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let migrationsDirResolved = ""; | ||
| const candidates = [ | ||
| path.join(process.cwd(), "prisma", "migrations"), | ||
| path.join(__dirname, "..", "prisma", "migrations"), |
There was a problem hiding this comment.
packages/happy-server is ESM ("type": "module"), so __dirname is not defined at runtime. This will throw a ReferenceError when migrate() runs under tsx. Please derive the directory from import.meta.url (as done elsewhere in the repo) or otherwise compute the module directory in an ESM-safe way before using it in the candidates list.
__dirname is unavailable in ESM and the server tsconfig uses commonjs, so use process.cwd() + known monorepo path instead. 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>
Summary
Three one-line fixes for build and security issues:
.gitignore(fix: .gitignore に .env.production を追加 #868): Add.env.productionto prevent accidental commit of secrets (HANDY_MASTER_SECRET)Dockerfile(fix(docker): Dockerfile にCOPY patchesが不足 & standalone マイグレーションのパス不正 #866): Add missingCOPY patches ./patches—postinstall.cjsrequiresfix-pglite-prisma-bytes.cjswhich isn't copied, breakingyarn installin the standalone Docker buildstandalone.ts(fix(docker): Dockerfile にCOPY patchesが不足 & standalone マイグレーションのパス不正 #866): Add__dirname-relative candidate forprisma/migrationsso the migration finder works when WORKDIR is/repo(Docker) instead ofpackages/happy-server/Note on #113: The
--authflag docs are on https://happy.engineering/docs/ (separate reposlopus/slopus.github.io), not in this repo. The CLI source already useshappy auth login.Closes #868, closes #866
Test plan
docker build -f Dockerfile .completes without postinstall error.env.productionis ignored by git🤖 Generated with Claude Code via Happy