File size: 1,581 Bytes
627fe4a
d266ceb
11f2140
627fe4a
9c7dff6
d266ceb
81ed403
5716ff9
d266ceb
5716ff9
 
 
954262a
627fe4a
d266ceb
11f2140
5716ff9
 
 
 
6db91f9
cbed4d3
 
330e3e3
6db91f9
cbed4d3
c7873bf
 
 
da551e8
11f2140
 
 
 
d266ceb
627fe4a
11f2140
d266ceb
627fe4a
da551e8
c7873bf
6db91f9
 
7989fea
d266ceb
a6c9d23
 
d266ceb
5716ff9
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
# Use an official Python image
FROM nvidia/cuda:11.8.0-base-ubuntu22.04

# Set up Python environment
ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

# Install system packages and Python 3.12
RUN apt-get update && apt-get install -y \
    software-properties-common && \
    add-apt-repository ppa:deadsnakes/ppa && \
    apt-get update && apt-get install -y \
    python3.12 python3.12-venv python3.12-dev \
    wget git calibre ffmpeg libmecab-dev mecab mecab-ipadic python3-pip \
    && apt-get clean && rm -rf /var/lib/apt/lists/*

# Make 'python' command work for Python 3.12
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 && \
    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1

# Install pip, setuptools, and wheel manually
RUN wget https://bootstrap.pypa.io/get-pip.py && \
    python get-pip.py && \
    rm get-pip.py && \
    pip install --no-cache-dir --upgrade pip setuptools wheel

# Explicitly install regex
RUN pip install --no-cache-dir regex --force-reinstall

# Create and switch to a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory
WORKDIR /home/user/app

# Clone the GitHub repository
RUN git clone https://github.com/DrewThomasson/ebook2audiobook.git /home/user/app

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
    pip install --no-cache-dir --use-pep517 -r requirements.txt

# Expose the application port
EXPOSE 7860

# Start the Gradio app
CMD ["python", "app.py"]