File size: 1,177 Bytes
11f2140
 
 
da551e8
11f2140
da551e8
11f2140
 
 
 
da551e8
11f2140
 
a6c9d23
 
 
 
 
 
da551e8
11f2140
 
 
da551e8
 
 
 
 
 
 
 
a6c9d23
da551e8
a6c9d23
 
da551e8
a6c9d23
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
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile

FROM python:3.10

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

# Set a working directory for temporary operations
WORKDIR /app

# Install system packages from packages.txt
COPY --chown=user ./packages.txt packages.txt
USER root
RUN apt-get update && xargs -a packages.txt apt-get install -y && apt-get clean && rm -rf /var/lib/apt/lists/*
USER user

# Install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Clone the GitHub repository and set it as the working directory
USER root
RUN apt-get update && apt-get install -y git && apt-get clean && rm -rf /var/lib/apt/lists/*
USER user
RUN git clone https://github.com/DrewThomasson/ebook2audiobook.git /home/user/ebook2audiobook

# Set the cloned repository as the base working directory
WORKDIR /home/user/ebook2audiobook

# Expose the required port
EXPOSE 7860

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