Files
vixtix/Dockerfile
Victor 6daa8f7f59 feat: migrate schema to DATE type, add test infrastructure
- Migrate due_date/next_occurrence columns from TIMESTAMPTZ to DATE
- Update serializeRow() to distinguish DATE vs TIMESTAMPTZ serialization
- Simplify frontend date parsing (no more timezone workarounds)
- Add Vitest + Testing Library test infrastructure
- Add initial date parsing/formatting unit tests
- Update package.json with dev dependencies (vitest, testing-library, jsdom)
2026-05-03 03:16:54 +00:00

52 lines
1.1 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 . .
# 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, netcat, and tsx for migrations
RUN apk add --no-cache postgresql-client netcat-openbsd && \
npm install -g tsx
# 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/standalone/ ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
COPY --from=builder /app/package.json ./
# Copy migration script (for initial setup)
COPY --chown=nextjs:nodejs src/server/db/migrate.ts ./migrate.ts
# Create startup script
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
USER nextjs
EXPOSE 3000
CMD ["/app/start.sh"]