-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
63 lines (52 loc) · 2.18 KB
/
Dockerfile
File metadata and controls
63 lines (52 loc) · 2.18 KB
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
54
55
56
57
58
59
60
61
62
63
# Dockerfile
# ---------------------------------------------------------
# Base Image — Node 20 + Debian (Render compatible)
# Includes Python + Tesseract for OCR worker
# ---------------------------------------------------------
FROM node:20-bullseye
# Make Python output unbuffered (critical for OCR piping)
ENV PYTHONUNBUFFERED=1
ENV NODE_ENV=production
# ---------------------------------------------------------
# Install system dependencies (Python + Tesseract OCR)
# ---------------------------------------------------------
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python3 \
python3-pip \
python3-venv \
tesseract-ocr \
tesseract-ocr-eng \
libtesseract-dev && \
rm -rf /var/lib/apt/lists/*
# ---------------------------------------------------------
# Set project root
# ---------------------------------------------------------
WORKDIR /usr/src/app
# ---------------------------------------------------------
# Install Node dependencies (use api/ package.json)
# ---------------------------------------------------------
COPY api/package*.json ./api/
WORKDIR /usr/src/app/api
# Use npm ci when lockfile exists (more reproducible), fallback is fine if no lock
RUN if [ -f package-lock.json ]; then npm ci --omit=dev; else npm install --omit=dev; fi
# ---------------------------------------------------------
# Install Python OCR worker dependencies
# ---------------------------------------------------------
WORKDIR /usr/src/app
COPY worker/requirements.txt ./worker/requirements.txt
RUN pip3 install --no-cache-dir -r worker/requirements.txt
# ---------------------------------------------------------
# Copy full project AFTER deps installed (better layer caching)
# ---------------------------------------------------------
COPY . .
# ---------------------------------------------------------
# Backend working directory
# ---------------------------------------------------------
WORKDIR /usr/src/app/api
# Render will set PORT, but local dev uses 4000
EXPOSE 4000
# Ensure the python binary name matches your env defaults
# (you can still override with PYTHON_BIN)
ENV PYTHON_BIN=python3
CMD ["node", "src/server.js"]