From bd4e743a3045940e1b1afaf27ee225c695827cda Mon Sep 17 00:00:00 2001 From: Nikaidou Haruki Date: Wed, 2 Sep 2026 13:50:29 +0900 Subject: [PATCH] Run database migrations on startup Add railway.json config and update Dockerfile entrypoint to run migrations before starting the server. --- Dockerfile | 2 +- railway.json | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 railway.json diff --git a/Dockerfile b/Dockerfile index dfe6ca3..f543b19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -98,4 +98,4 @@ USER nobody # above and adding an entrypoint. See https://github.com/krallin/tini for details # ENTRYPOINT ["/tini", "--"] -CMD ["/app/bin/server"] +CMD ["/bin/sh", "-c", "/app/bin/migrate && /app/bin/server"] diff --git a/railway.json b/railway.json new file mode 100644 index 0000000..7f9a75f --- /dev/null +++ b/railway.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://railway.com/railway.schema.json", + "build": { + "builder": "DOCKERFILE", + "dockerfilePath": "Dockerfile" + }, + "deploy": { + "startCommand": "/app/bin/migrate && /app/bin/server", + "restartPolicyType": "ON_FAILURE", + "restartPolicyMaxRetries": 10 + } +}