Skip to content

fix(docker): Dockerfile に COPY patches が不足 & standalone マイグレーションのパス不正 #866

@kanosan-wataru

Description

@kanosan-wataru

概要

Dockerビルドが2つの問題で失敗する。

問題1: patches/ ディレクトリがコピーされていない

postinstall.cjs../patches/fix-pglite-prisma-bytes.cjs を参照しているが、Dockerfileに COPY patches ./patches がないためビルドが失敗する。

Error: Cannot find module '../patches/fix-pglite-prisma-bytes.cjs'

修正

Dockerfile, Dockerfile.server, Dockerfile.webappCOPY scripts ./scripts の直後に追加:

COPY patches ./patches

問題2: standalone.ts が prisma/migrations を見つけられない

standalone.tsmigrate()process.cwd() + "/prisma/migrations" を探すが、Docker内のWORKDIRは /repo のため /repo/prisma/migrations を探してしまう。実際のパスは /repo/packages/happy-server/prisma/migrations

Could not find prisma/migrations directory

修正

CMDを packages/happy-server ディレクトリから実行するよう変更:

CMD ["sh", "-c", "cd packages/happy-server && /repo/node_modules/.bin/tsx sources/standalone.ts migrate && exec /repo/node_modules/.bin/tsx sources/standalone.ts serve"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions