SQLite Error: Database is locked with Docker + Next.js + Drizzle

My
docker-compose.yml
is:

version: '3'

services:
  docker-production:
    build:
      context: .
      dockerfile: Dockerfile
    image: docker-production
    env_file:
      - .env.production
    ports:
      - '3001:3000'
    volumes:
      - ./data:/data


my
Dockerfile
is huge but the relevant bits are:

RUN mkdir -p /data
RUN npm run db:generate
RUN npm run db:migrate:vps
RUN npm run build


i do it in production just like i do it in development.

i don't think i need migrate at all in production so i sometimes comment it out. i probably need to copy
migrations
folder into production i guess. can someone correct me here?

anyhow, i get database locked error at the
npm run build
command that next.js needs to build production builds.

i've detailed my question on stackoverflow as discord doesn't allow long-form code without going over character limit.

https://stackoverflow.com/q/77986435/6141587

please take a look if you got sqlite + drizzle working on docker? there are few resources on this. many are complicated af.
Stack Overflow
I have a Next.js application that I'm trying to dockerize.
My stack is Next.js (Node.js framework) + Docker + Drizzle ORM + better-sqlite3
It currently works in development without docker using pnp...
Was this page helpful?