Fix seed script unreadable in image: COPY --chmod applied 0644 to the auto-created /app/scripts dir (unsearchable for the node user → MODULE_NOT_FOUND). Seed now lives at /app/pb-seed.mjs.

This commit is contained in:
2026-09-06 13:48:15 +05:30
parent 7d29886975
commit f68ddad6f3
2 changed files with 4 additions and 5 deletions
+1 -2
View File
@@ -60,8 +60,7 @@ RUN --mount=type=cache,target=/root/.npm \
npm ci --omit=dev --no-audit --no-fund
COPY --from=builder --chown=root:root /app/dist ./dist
COPY --chmod=0644 server.mjs entrypoint.sh ./
COPY --chmod=0644 scripts/pb-seed.mjs ./scripts/pb-seed.mjs
COPY --chmod=0644 server.mjs entrypoint.sh scripts/pb-seed.mjs ./
# Run as the unprivileged `node` user shipped with the base image.
USER node
+3 -3
View File
@@ -25,9 +25,9 @@ PB_PID=$!
# when records already exist or no superuser env is provided)
(
sleep 2
if [ ! -f scripts/pb-seed.mjs ]; then
echo "[entrypoint] WARNING: scripts/pb-seed.mjs missing from image — the image was built from a stale checkout; rebuild it"
elif node scripts/pb-seed.mjs; then
if [ ! -f pb-seed.mjs ]; then
echo "[entrypoint] WARNING: pb-seed.mjs missing from image — the image was built from a stale checkout; rebuild it"
elif node pb-seed.mjs; then
echo "[entrypoint] pocketbase seed complete"
else
echo "[entrypoint] pocketbase seed skipped/failed — site falls back to bundled defaults"