-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (29 loc) · 1.21 KB
/
Dockerfile
File metadata and controls
38 lines (29 loc) · 1.21 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
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Install system dependencies (Tesseract, wget, and their dependencies)
RUN apt-get update && apt-get install -y \
tesseract-ocr \
libtesseract-dev \
libleptonica-dev \
wget \
&& rm -rf /var/lib/apt/lists/*
# Download Tesseract language data
RUN mkdir -p /usr/share/tesseract-ocr/4.00/tessdata && \
cd /usr/share/tesseract-ocr/4.00/tessdata && \
wget https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata && \
wget https://github.com/tesseract-ocr/tessdata/raw/main/hin.traineddata && \
wget https://github.com/tesseract-ocr/tessdata/raw/main/mar.traineddata
# Set TESSDATA_PREFIX environment variable
ENV TESSDATA_PREFIX=/usr/share/tesseract-ocr/4.00/tessdata
# Copy the current directory contents into the container at /app
COPY . /app
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Install Gunicorn
RUN pip install gunicorn
# Expose port 8080 (Railway's default port)
EXPOSE 8080
# Run the Flask app using Gunicorn
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "app:app"]