File size: 2,168 Bytes
57b5ba6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a780002
 
 
d088cf1
74adea1
d088cf1
 
 
a780002
 
d088cf1
57b5ba6
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Use a slim version of Python runtime as a parent image
FROM python:3.10.13

# Prevent Python from writing .pyc files and buffering stdout/stderr
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Install necessary system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    ffmpeg \
    libsndfile1 \
    git \
    wget \
    libegl1 \
    libgl1 \
    libgl1-mesa-glx \
    libopengl0 \
    libxcb-cursor0 \
    libxcb-shape0 \
    libxcb-randr0 \
    libxcb-render0 \
    libxcb-render-util0 \
    libxcb-image0 \
    libxcb-keysyms1 \
    libxcb-glx0 \
    libxkbcommon0 \
    libxkbcommon-x11-0 \
    libx11-xcb1 \
    libxrender1 \
    libxfixes3 \
    libxdamage1 \
    libxext6 \
    libsm6 \
    libx11-6 \
    libxft2 \
    libxinerama1 \
    libxrandr2 \
    libxcomposite1 \
    libxcursor1 \
    libxi6 \
    libfontconfig1 \
    libfreetype6 \
    libssl3 \
    libxml2 \
    libxslt1.1 \
    libsqlite3-0 \
    zlib1g \
    libopenjp2-7 \
    libjpeg62-turbo \
    libpng16-16 \
    libtiff-dev \
    libwebp7 \
    poppler-utils \
    libxml2-dev \
    libxslt1-dev \
    libgtk-3-0 \
    libglib2.0-0 \
    libglib2.0-data \
    libice6 \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install Calibre (which includes ebook-convert)
RUN wget -nv -O- https://download.calibre-ebook.com/linux-installer.sh | sh /dev/stdin

# Ensure that ebook-convert is available in PATH
ENV PATH="/root/calibre:${PATH}"

# Set working directory
WORKDIR /app

# Create necessary directories
RUN mkdir -p /app/Working_files/Book /app/Working_files/temp_ebook /app/Working_files/temp

# Copy the requirements file
COPY requirements.txt .

# Install Python dependencies
RUN pip install --upgrade pip
RUN pip install --no-cache-dir --verbose -r requirements.txt

# Set a writable cache directory
ENV TRANSFORMERS_CACHE=/app/cache

ENV NUMBA_DISABLE_JIT=1


# Set writable cache directory using HF_HOME
ENV HF_HOME=/app/cache
RUN mkdir -p /app/cache


# Download NLTK data
RUN python -m nltk.downloader punkt

# Copy your application files
COPY app.py .

# **Set ENTRYPOINT and CMD**
ENTRYPOINT ["python", "app.py"]
CMD []