- Add reminders to Prisma schema (Reminder model, TaskReminder relation) - Add /api/reminders endpoint and cron send-reminders.ts script - Add reminder fields to NewTaskModal and EditTaskModal components - Fix reminder datetime serialization: use toISOString().slice(0,16) for UTC-safe YYYY-MM-DDTHH:mm format compatible with datetime-local inputs - Update Dockerfile to install tsx for cron container - Add AGENTS.md with project conventions - Update docker-compose.yml with cron service and build context
61 lines
1.2 KiB
Docker
61 lines
1.2 KiB
Docker
# Build stage
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json package-lock.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Generate Prisma client
|
|
RUN npx prisma generate
|
|
|
|
# Build the Next.js app
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:22-alpine
|
|
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV HOSTNAME="0.0.0.0"
|
|
ENV PORT=3000
|
|
|
|
# Install postgres client and netcat
|
|
RUN apk add --no-cache postgresql-client netcat-openbsd
|
|
|
|
# Create a non-root user
|
|
RUN addgroup --system --gid 1001 nodejs && \
|
|
adduser --system --uid 1001 nextjs
|
|
|
|
# Copy the built app from builder
|
|
COPY --from=builder /app/public ./public
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
|
COPY --from=builder /app/package.json ./
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
COPY --from=builder /app/prisma ./prisma
|
|
# Copy generated Prisma client (includes native query engine binary)
|
|
COPY --from=builder /app/src/generated ./src/generated
|
|
|
|
# Copy cron script for reminder notifications
|
|
COPY --from=builder /app/scripts ./scripts
|
|
|
|
# Install tsx for cron worker
|
|
RUN npm install -g tsx
|
|
|
|
# Copy startup script
|
|
COPY start.sh /app/start.sh
|
|
RUN chmod +x /app/start.sh
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["/app/start.sh"]
|