Skip to content

Commit 251f11f

Browse files
junzero741claude
andcommitted
fix(docker): use start.sh script instead of railway.toml startCommand
Railway was ignoring startCommand, so move migration + server start into a shell script baked into the Docker image. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8413dfc commit 251f11f

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

apps/backend/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ COPY --from=builder /app/apps/backend/prisma ./prisma
4747
# Create prisma.config.js for production (reads DATABASE_URL from env)
4848
RUN echo 'const { defineConfig } = require("prisma/config"); module.exports = defineConfig({ schema: "prisma/schema.prisma", migrations: { path: "prisma/migrations" }, datasource: { url: process.env.DATABASE_URL } });' > prisma.config.js
4949

50+
COPY --from=builder /app/apps/backend/start.sh ./
51+
RUN chmod +x start.sh
52+
5053
EXPOSE 4000
5154

52-
CMD ["node", "main.js"]
55+
CMD ["./start.sh"]

apps/backend/start.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
set -e
3+
echo "Running migrations..."
4+
npx prisma migrate deploy
5+
echo "Starting server..."
6+
exec node main.js

railway.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
dockerfilePath = "apps/backend/Dockerfile"
33

44
[deploy]
5-
startCommand = "npx prisma migrate deploy; echo 'MIGRATE DONE'; node main.js; echo \"NODE EXIT: $?\""
65
restartPolicyType = "ON_FAILURE"

0 commit comments

Comments
 (0)