Files
basil/packages/api/Dockerfile
Paul R Kartchner b4be894470 feat: improve recipe import UX and add comprehensive test coverage
## Changes

### Recipe Import Improvements
- Move tag input to top of import preview for better UX
- Allow users to add tags immediately after importing, before viewing full details
- Keep focus in tag input field after pressing Enter for rapid tag addition

### Recipe Scraper Enhancements
- Remove deprecated supported_only parameter from Python scraper
- Update Dockerfile to explicitly install latest recipe-scrapers package
- Ensure compatibility with latest recipe-scrapers library (14.55.0+)

### Testing Infrastructure
- Add comprehensive tests for recipe tagging features (87% coverage)
- Add real integration tests for auth routes (37% coverage on auth.routes.ts)
- Add real integration tests for backup routes (74% coverage on backup.routes.ts)
- Add real integration tests for scraper service (67% coverage)
- Overall project coverage improved from 72.7% to 77.6%

### Test Coverage Details
- 377 tests passing (up from 341)
- 7 new tests for quick tagging feature
- 17 new tests for authentication flows
- 16 new tests for backup functionality
- 6 new tests for recipe scraper integration

All tests verify:
- Tag CRUD operations work correctly
- Tags properly connected using connectOrCreate pattern
- Recipe import with live URL scraping
- Security (path traversal prevention, rate limiting)
- Error handling and validation

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-16 22:00:56 -07:00

52 lines
1.4 KiB
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy workspace root files
COPY package*.json ./
COPY packages/shared ./packages/shared
COPY packages/api ./packages/api
# Install dependencies
RUN npm install
# Build shared package
WORKDIR /app/packages/shared
RUN npm run build
# Build API
WORKDIR /app/packages/api
RUN npm run prisma:generate
RUN npm run build
# Production stage
FROM node:20-alpine
# Install OpenSSL for Prisma and Python for recipe-scrapers
RUN apk add --no-cache openssl python3 py3-pip
# Install latest recipe-scrapers Python package
RUN pip3 install --break-system-packages --upgrade recipe-scrapers
WORKDIR /app
# Copy built files and dependencies
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/packages/shared/package.json ./packages/shared/
COPY --from=builder /app/packages/shared/dist ./packages/shared/dist
COPY --from=builder /app/packages/api/package.json ./packages/api/
COPY --from=builder /app/packages/api/dist ./packages/api/dist
COPY --from=builder /app/packages/api/prisma ./packages/api/prisma
COPY --from=builder /app/packages/api/scripts ./packages/api/scripts
COPY --from=builder /app/node_modules ./node_modules
WORKDIR /app/packages/api
# Create uploads directory and make Python script executable
RUN mkdir -p /app/uploads && chmod +x scripts/scrape_recipe.py
EXPOSE 3001
CMD ["sh", "-c", "npx prisma migrate deploy && node dist/index.js"]