Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +24 -17
Dockerfile
CHANGED
@@ -1,35 +1,42 @@
|
|
1 |
# Use the official Python 3.11 slim image as the base
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
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 |
-
|
|
|
|
|
17 |
|
18 |
-
# Create and activate virtual environment
|
19 |
-
RUN
|
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 /
|
25 |
-
wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx -P /
|
26 |
-
wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json -P /
|
27 |
-
|
28 |
-
# Set the working directory to /ebooks
|
29 |
-
WORKDIR /ebooks
|
30 |
|
31 |
-
# Create
|
32 |
-
|
|
|
33 |
|
34 |
-
#
|
35 |
-
CMD for book in *.epub; do $VENV_PATH/bin/audiblez "$book" -v af_aoede; done && cp *.m4b /m4b/
|
|
|
1 |
# Use the official Python 3.11 slim image as the base
|
2 |
FROM python:3.11-slim
|
3 |
|
4 |
+
# Create non-root user
|
5 |
+
RUN useradd -ms /bin/bash appuser
|
6 |
+
USER appuser
|
7 |
+
WORKDIR /home/appuser
|
8 |
+
|
9 |
+
# Set venv path
|
10 |
+
ENV VENV_PATH="/home/appuser/venv"
|
11 |
ENV PATH="$VENV_PATH/bin:$PATH"
|
12 |
|
13 |
# Install system dependencies
|
14 |
+
USER root
|
15 |
RUN apt-get update && \
|
16 |
apt-get install -y --no-install-recommends \
|
17 |
ffmpeg \
|
18 |
espeak-ng \
|
19 |
wget \
|
20 |
python3-venv && \
|
21 |
+
apt-get clean && rm -rf /var/lib/apt/lists/*
|
22 |
+
|
23 |
+
# Switch back to non-root user
|
24 |
+
USER appuser
|
25 |
|
26 |
+
# Create and activate virtual environment
|
27 |
+
RUN python3 -m venv $VENV_PATH && \
|
28 |
$VENV_PATH/bin/pip install --no-cache-dir --upgrade pip && \
|
29 |
+
$VENV_PATH/bin/pip install --no-cache-dir audiblez && \
|
30 |
+
$VENV_PATH/bin/python -m spacy download xx_ent_wiki_sm
|
31 |
|
32 |
# Download Kokoro model and voices
|
33 |
+
RUN mkdir -p /home/appuser/.local/share/audiblez/ && \
|
34 |
+
wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/kokoro-v0_19.onnx -P /home/appuser/.local/share/audiblez/ && \
|
35 |
+
wget https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json -P /home/appuser/.local/share/audiblez/
|
|
|
|
|
|
|
36 |
|
37 |
+
# Create working and output directories
|
38 |
+
WORKDIR /home/appuser/ebooks
|
39 |
+
RUN mkdir -p /home/appuser/m4b
|
40 |
|
41 |
+
# Convert and copy m4b files
|
42 |
+
CMD for book in *.epub; do $VENV_PATH/bin/audiblez "$book" -v af_aoede; done && cp *.m4b /home/appuser/m4b/
|