Skip to content

fix: gitignore .env.production + Docker build fixes (#868, #866)#911

Open
chris-yyau wants to merge 2 commits intoslopus:mainfrom
chris-yyau:fix/quick-wins-868-866-113
Open

fix: gitignore .env.production + Docker build fixes (#868, #866)#911
chris-yyau wants to merge 2 commits intoslopus:mainfrom
chris-yyau:fix/quick-wins-868-866-113

Conversation

@chris-yyau
Copy link

Summary

Three one-line fixes for build and security issues:

  1. .gitignore (fix: .gitignore に .env.production を追加 #868): Add .env.production to prevent accidental commit of secrets (HANDY_MASTER_SECRET)
  2. Dockerfile (fix(docker): Dockerfile に COPY patches が不足 & standalone マイグレーションのパス不正 #866): Add missing COPY patches ./patchespostinstall.cjs requires fix-pglite-prisma-bytes.cjs which isn't copied, breaking yarn install in the standalone Docker build
  3. standalone.ts (fix(docker): Dockerfile に COPY patches が不足 & standalone マイグレーションのパス不正 #866): Add __dirname-relative candidate for prisma/migrations so the migration finder works when WORKDIR is /repo (Docker) instead of packages/happy-server/

Note on #113: The --auth flag docs are on https://happy.engineering/docs/ (separate repo slopus/slopus.github.io), not in this repo. The CLI source already uses happy auth login.

Closes #868, closes #866

Test plan

  • docker build -f Dockerfile . completes without postinstall error
  • Standalone container runs migrations successfully
  • .env.production is ignored by git

🤖 Generated with Claude Code via Happy

…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>
Copilot AI review requested due to automatic review settings March 24, 2026 13:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.production in git to reduce risk of committing secrets.
  • Fix standalone Docker build by copying the repo patches/ directory into the image.
  • Add an additional prisma/migrations lookup candidate intended to work when WORKDIR differs (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"),
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
__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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: .gitignore に .env.production を追加 fix(docker): Dockerfile に COPY patches が不足 & standalone マイグレーションのパス不正

2 participants