FROM node:24-alpine

# better-sqlite3 is a native module and is compiled here against this exact
# Node version — the reason a Node upgrade needs a rebuild, not just a retag.
RUN apk add --no-cache python3 make g++

WORKDIR /app
COPY package.json package-lock.json* ./
RUN npm install --omit=dev
COPY . .

RUN mkdir -p /app/data /app/uploads

EXPOSE 4000
CMD ["node", "server.js"]