diff --git a/Dockerfile b/Dockerfile index c87ae908..06a5140b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,5 +50,4 @@ COPY --from=build /myapp/build /myapp/build COPY --from=build /myapp/public /myapp/public ADD . . -RUN npx prisma migrate deploy CMD ["npm", "start"] diff --git a/fly.toml b/fly.toml index c04dba03..9d9f1b32 100644 --- a/fly.toml +++ b/fly.toml @@ -12,6 +12,8 @@ processes = [] [experimental] allowed_public_ports = [] auto_rollback = true + cmd = "start.sh" + entrypoint = "sh" [mounts] source = "data" diff --git a/start.sh b/start.sh new file mode 100644 index 00000000..96e221b8 --- /dev/null +++ b/start.sh @@ -0,0 +1,10 @@ +# This file is how Fly starts the server (configured in fly.toml). Before starting +# the server though, we need to run any prisma migrations that haven't yet been +# run, which is why this file exists in the first place. +# Learn more: https://community.fly.io/t/sqlite-not-getting-setup-properly/4386 + +#!/bin/sh + +set -ex +npx prisma migrate deploy +npm run start