MoiMoi-01 commited on
Commit
a361896
·
verified ·
1 Parent(s): 3efd9f1

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -9
Dockerfile CHANGED
@@ -2,30 +2,34 @@
2
  FROM python:3.11-slim
3
 
4
  # Set environment variables
5
- ENV PATH="/root/.local/bin:$PATH"
 
6
 
7
  # Install system dependencies
8
  RUN apt-get update && \
9
  apt-get install -y --no-install-recommends \
10
  ffmpeg \
11
  espeak-ng \
12
- wget && \
 
13
  apt-get clean && \
14
  rm -rf /var/lib/apt/lists/*
15
 
16
- # Install Audiblez
17
- RUN pip install --no-cache-dir audiblez
 
 
18
 
19
  # Download Kokoro model and voices
20
- RUN wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx -P /root/.local/share/audiblez/ && \
 
21
  wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json -P /root/.local/share/audiblez/
22
 
23
- # Set the working directory
24
  WORKDIR /ebooks
25
 
26
  # Create the /m4b directory
27
  RUN mkdir -p /m4b
28
 
29
- # Convert all .epub files in the /ebooks directory to audiobooks using the af_sky voice
30
- # and move the resulting .m4b files to the /m4b directory
31
- CMD for book in *.epub; do audiblez "$book" -v af_sky; done && cp *.m4b /m4b/
 
2
  FROM python:3.11-slim
3
 
4
  # Set environment variables
5
+ ENV VENV_PATH="/venv"
6
+ ENV PATH="$VENV_PATH/bin:$PATH"
7
 
8
  # Install system dependencies
9
  RUN apt-get update && \
10
  apt-get install -y --no-install-recommends \
11
  ffmpeg \
12
  espeak-ng \
13
+ wget \
14
+ python3-venv && \
15
  apt-get clean && \
16
  rm -rf /var/lib/apt/lists/*
17
 
18
+ # Create and activate virtual environment, then install audiblez
19
+ RUN python -m venv $VENV_PATH && \
20
+ $VENV_PATH/bin/pip install --no-cache-dir --upgrade pip && \
21
+ $VENV_PATH/bin/pip install --no-cache-dir audiblez
22
 
23
  # Download Kokoro model and voices
24
+ RUN mkdir -p /root/.local/share/audiblez/ && \
25
+ wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx -P /root/.local/share/audiblez/ && \
26
  wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json -P /root/.local/share/audiblez/
27
 
28
+ # Set the working directory to /ebooks
29
  WORKDIR /ebooks
30
 
31
  # Create the /m4b directory
32
  RUN mkdir -p /m4b
33
 
34
+ # Copy all .m4b output to /m4b after conversion using audiblez from venv
35
+ CMD for book in *.epub; do $VENV_PATH/bin/audiblez "$book" -v af_aoede; done && cp *.m4b /m4b/