Some checks failed
Create Release / release (push) Has been cancelled
- Add postinstall script to copy worker to static/ - Update Dockerfile to copy worker during build - Update file-processor to try local worker first, fallback to CDN - Bump version to 0.4.11
42 lines
782 B
Docker
42 lines
782 B
Docker
# Build stage
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies
|
|
RUN npm ci
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Copy PDF.js worker to static directory for local serving
|
|
# This avoids CDN dependency and CORS issues with ESM modules
|
|
RUN cp node_modules/pdfjs-dist/build/pdf.worker.min.mjs static/
|
|
|
|
# Build the application
|
|
RUN npm run build
|
|
|
|
# Production stage
|
|
FROM node:22-alpine AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/build ./build
|
|
COPY --from=builder /app/package*.json ./
|
|
COPY --from=builder /app/node_modules ./node_modules
|
|
|
|
# Expose port
|
|
EXPOSE 3000
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOST=0.0.0.0
|
|
|
|
# Start the application
|
|
CMD ["node", "build"]
|