# Use Node.js LTS version FROM node:18-alpine # Install Tesseract OCR dependencies RUN apk add --no-cache \ tesseract-ocr \ tesseract-ocr-data-eng \ build-base \ cairo-dev \ jpeg-dev \ pango-dev \ giflib-dev \ pixman-dev # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm install # Copy application files COPY . . # Create necessary directories RUN mkdir -p uploads public # Set permissions RUN chmod -R 755 /app # Expose port EXPOSE 7860 # Set environment variables ENV NODE_ENV=production ENV PORT=7860 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD node -e "require('http').get('http://localhost:3000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" # Start application CMD ["node", "index.js"]