Spaces:
Sleeping
Sleeping
File size: 1,202 Bytes
4bf0aa2 51c14fb 4bf0aa2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # Use Node.js for the base as it's the main entry point
FROM node:18-bullseye-slim
# Install Python and build dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
python3-dev \
libgl1-mesa-glx \
libgomp1 \
libsm6 \
libxext6 \
libxrender-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set python3 as the default python
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /app
# Copy package files
COPY package.json package-lock.json ./
# Install Node dependencies
RUN npm install --production
# Copy python requirements
COPY backend/src/python/requirements.txt ./python_requirements.txt
# Install Python dependencies
RUN pip install --no-cache-dir -r python_requirements.txt
# Pre-download PaddleOCR models to cache them in the image
RUN python -c "from paddleocr import PaddleOCR; PaddleOCR(use_textline_orientation=True, lang='en')"
# Copy all source code
COPY . .
# Set environment variables
ENV NODE_ENV=production
ENV PYTHON_OCR_URL=http://localhost:5001/ocr
ENV PORT=7860
# Make start script executable
RUN chmod +x start.sh
# Hugging Face Spaces run on port 7860
EXPOSE 7860
# Start both servers
CMD ["./start.sh"]
|