diff --git a/Dockerfile b/Dockerfile index 92675ca..721c6f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,14 @@ COPY package.json package-lock.json ./ RUN npm ci COPY . . +# `next build`'s page-data collection spins up several parallel workers that +# each import the db client at module-eval time. If data/db.sqlite doesn't +# exist yet, every worker races to create it from scratch — that race is at +# the file-creation level, before our code ever gets to run a busy_timeout +# pragma, so it can throw SQLITE_BUSY (or worse) independent of pragma order. +# Migrating first — as its own isolated, single-process step — means the +# workers only ever see an already-existing, already-stable file. +RUN mkdir -p data && npm run db:migrate RUN npm run build ENV NODE_ENV=production