diff --git a/Dockerfile.migrator b/Dockerfile.migrator index 35ed286..4c3690f 100644 --- a/Dockerfile.migrator +++ b/Dockerfile.migrator @@ -1,8 +1,7 @@ # syntax=docker/dockerfile:1 # Migrator image — runs `payload migrate` / `payload migrate:create` -# Requires node:22 for pnpm 11 (node:sqlite). -# tsx 4.x ESM loader must be preloaded via NODE_OPTIONS so bare -# specifiers (.ts extensions) resolve before any module is imported. +# tsx is used as the RUNNER (not as a hook) to avoid the Node.js v22 +# importSyncForRequire bug that breaks --import tsx/esm hook mode. FROM node:22-alpine AS base RUN corepack enable && corepack prepare pnpm@latest --activate @@ -13,6 +12,5 @@ RUN pnpm install --frozen-lockfile COPY . . -ENV NODE_OPTIONS="--import tsx/esm" -ENTRYPOINT ["pnpm", "payload"] -CMD ["migrate"] +ENTRYPOINT ["pnpm", "exec", "tsx"] +CMD ["node_modules/payload/bin.js", "migrate"]