# Build stage FROM node:20-slim AS builder WORKDIR /app # Install build dependencies for better-sqlite3 RUN apt-get update && apt-get install -y python3 make g++ COPY package*.json ./ RUN npm install COPY . . RUN npm run build # Production stage FROM node:20-slim WORKDIR /app # Install production dependencies only COPY package*.json ./ RUN apt-get update && apt-get install -y python3 make g++ \ && npm install --omit=dev \ && apt-get purge -y python3 make g++ \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* COPY --from=builder /app/build ./build COPY --from=builder /app/static ./static # Ensure the database file isn't baked in unless desired, # but adapter-node needs the build folder. # The app will create data.db in /app/ at runtime. ENV PORT=1995 ENV NODE_ENV=production EXPOSE 1995 CMD ["node", "build"]