fix: replace fragile printf start.sh with COPY start.sh

The RUN printf approach had a POSIX printf bug where \\c stopped
output, truncating the startup script. Now start.sh is a proper
file COPYed into the image.
This commit is contained in:
Antigravity AI
2026-06-28 18:10:56 +08:00
parent 6850b350f7
commit 641b5a2769
2 changed files with 10 additions and 4 deletions
+2 -4
View File
@@ -37,10 +37,8 @@ RUN mkdir -p /app/data && chown nextjs:nodejs /app/data
RUN chown -R nextjs:nodejs /app/node_modules/@prisma /app/node_modules/prisma /app/node_modules/.prisma /app/prisma 2>/dev/null || true RUN chown -R nextjs:nodejs /app/node_modules/@prisma /app/node_modules/prisma /app/node_modules/.prisma /app/prisma 2>/dev/null || true
# Startup script — migrate volumes DB then launch server # Startup script — migrate volumes DB then launch server
RUN printf '#!/bin/sh\n\ COPY start.sh /app/start.sh
cd /app\n\ RUN chmod +x /app/start.sh
node ./node_modules/prisma/build/index.js db push --skip-generate --accept-data-loss 2>&1\n\
# Force 0.0.0.0 binding (Docker sets HOSTNAME to container ID)\nexport HOSTNAME=0.0.0.0\nexec node server.js\n' > /app/start.sh && chmod +x /app/start.sh
# ── Docker HEALTHCHECK ────────────────────────────────────────── # ── Docker HEALTHCHECK ──────────────────────────────────────────
# Auto-restarts container if health endpoint fails 3 times (30s interval, 10s timeout) # Auto-restarts container if health endpoint fails 3 times (30s interval, 10s timeout)
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
# Falah Mobile — container startup script
cd /app
# Run Prisma migrations against the volume-mounted DB
node ./node_modules/prisma/build/index.js db push --skip-generate --accept-data-loss 2>&1
# Force 0.0.0.0 binding (Docker sets HOSTNAME to container ID)
export HOSTNAME=0.0.0.0
exec node server.js