FROM node:22-alpine AS build WORKDIR /app # better-sqlite3 has a native addon with no prebuilt binary for this # platform/Node combo yet — build it from source. RUN apk add --no-cache python3 make g++ COPY package*.json ./ RUN npm install COPY . . RUN npm run build FROM node:22-alpine WORKDIR /app # Same native-addon rebuild needed for the production-only install below; # the toolchain is purged again afterward to keep the runtime image lean. RUN apk add --no-cache python3 make g++ COPY package*.json ./ RUN npm install --omit=dev && apk del python3 make g++ COPY --from=build /app/dist ./dist COPY --from=build /app/public ./public # DATA_DIR (SQLite DB) is a mutable runtime volume — not baked into the # image, so redeploys don't clobber host overrides / manual targets. ENV DATA_DIR=/app/data EXPOSE 3035 CMD ["node", "dist/index.js"]