FROM node:18-alpine

WORKDIR /app

# Install build dependencies for better-sqlite3
RUN apk add --no-cache python3 make g++

COPY package*.json ./
RUN npm install --production

COPY . .

# Initialize DB during build or rely on start
# We'll just ensure the directory is writable if needed, but sqlite file is created at runtime if not present.

EXPOSE 3000

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