unknown
|
d6b11424c0
|
...
|
2026-04-19 15:06:11 -07:00 |
|
unknown
|
4ba550e470
|
...
|
2026-04-18 08:12:56 -07:00 |
|
unknown
|
2126f70043
|
...
|
2026-04-17 04:24:05 -07:00 |
|
unknown
|
07635c7ee0
|
...
|
2026-04-16 17:39:33 -07:00 |
|
ROBERT MCDOWELL
|
7b61fe5bf4
|
v26.4.12
Added voice selection for each edited block (future chapter)
Session can be switch to another session in GUI gradio mode
Added textarea as ebook input
|
2026-04-12 17:40:24 -07:00 |
|
unknown
|
580febb459
|
...
|
2026-04-11 05:04:00 -07:00 |
|
Drew Thomasson
|
59edcc07b9
|
Merge pull request #1698 from DrewThomasson/DrewThomasson-hugginface-patch-1
Refactor Hugginface Dockerfile for clarity and organization
|
2026-04-10 14:23:58 -04:00 |
|
unknown
|
d2ba8fb1fc
|
...
|
2026-04-07 18:55:20 -07:00 |
|
unknown
|
389f06d964
|
...
|
2026-04-07 06:01:12 -07:00 |
|
Drew Thomasson
|
39f965a8c5
|
Refactor Dockerfile for clarity and organization
Here is the full modified `HuggingfaceDockerfile` with the best improvements cherry-picked from the other Dockerfile while keeping all HuggingFace Space requirements intact:
**Changes applied from the other Dockerfile:**
1. **`VOLUME` declarations** added — the other file correctly declares named volumes for `/app/ebooks`, `/app/audiobooks`, etc. These are still useful even on HF Spaces for clarity and tooling, but placed *before* the `USER 1000` switch so they're created as root with correct ownership.
2. **`DOCKER_DEVICE_STR` default corrected** — the other file uses `cu128` as its tag and sets a clean, valid JSON default. The HF file stays `cpu` but keeps the same clean quoting style (already consistent).
3. **`--allow-change-held-packages` kept** — both files have it, good.
4. **`set -eux` consistency** — the Calibre symlink block already uses it in the HF file; no change needed.
5. **Comment header style** — unified the section headers to match the cleaner `# ============================================================` style used consistently in the other file.
```dockerfile name=dockerfiles/HuggingfaceDockerfile url=https://github.com/DrewThomasson/ebook2audiobook/blob/DrewThomasson-workflow-patch-1/dockerfiles/HuggingfaceDockerfile
ARG PYTHON_VERSION=3.12
# ============================================================
# HF SPACES — SINGLE STAGE BUILD + RUNTIME
# ============================================================
FROM python:${PYTHON_VERSION}-slim-bookworm
ARG APP_VERSION=26.4.6
ARG DEVICE_TAG=cpu
ARG DOCKER_DEVICE_STR='{"name": "cpu", "os": "manylinux_2_28", "arch": "x86_64", "pyvenv": [3, 12], "tag": "cpu", "note": "HF Spaces CPU"}'
ARG DOCKER_PROGRAMS_STR="curl ffmpeg mediainfo nodejs npm espeak-ng sox tesseract-ocr"
ARG CALIBRE_INSTALLER_URL="https://download.calibre-ebook.com/linux-installer.sh"
ARG ISO3_LANG=eng
ARG INSTALL_RUST=1
LABEL org.opencontainers.image.title="ebook2audiobook" \
org.opencontainers.image.description="Generate audiobooks from e-books, voice cloning & 1158 languages!" \
org.opencontainers.image.version="${APP_VERSION}" \
org.opencontainers.image.authors="Drew Thomasson / Rob McDowell" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.source="https://github.com/DrewThomasson/ebook2audiobook"
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
DOCKER_DEVICE_STR=${DOCKER_DEVICE_STR} \
PIP_BREAK_SYSTEM_PACKAGES=1 \
PATH="/root/.cargo/bin:${PATH}" \
DEVICE_TAG=${DEVICE_TAG}
WORKDIR /app
# ============================================================
# System packages (build + runtime)
# ============================================================
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends --allow-change-held-packages \
gcc g++ make pkg-config cmake curl wget git bash xz-utils python3-dev \
fontconfig libfontconfig1 libfreetype6 libgl1 libegl1 libopengl0 \
libx11-6 libxext6 libxrender1 libxcb1 libxcb-render0 libxcb-shm0 \
libxcb-xfixes0 libxcb-cursor0 libgomp1 libsndfile1 \
${DOCKER_PROGRAMS_STR} tesseract-ocr-${ISO3_LANG}; \
rm -rf /var/lib/apt/lists/*
# ============================================================
# Refresh pip to a known-good version
# ============================================================
RUN find /usr/local/lib/python3.12/site-packages/pip* -type f -delete 2>/dev/null; \
find /usr/local/lib/python3.12/site-packages/pip* -type l -delete 2>/dev/null; \
curl -sS https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \
python3 /tmp/get-pip.py --ignore-installed && \
rm -f /tmp/get-pip.py && \
pip install --no-cache-dir setuptools wheel
# ============================================================
# Rust toolchain (needed by some Python deps at build time)
# ============================================================
RUN bash -o pipefail -c '\
if [ "${INSTALL_RUST}" = "1" ]; then \
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable; \
else \
echo "Skipping Rust toolchain"; \
fi'
# ============================================================
# Calibre (CLI only)
# ============================================================
RUN set -eux; \
wget -nv "${CALIBRE_INSTALLER_URL}" -O /tmp/calibre.sh; \
bash /tmp/calibre.sh; \
rm -f /tmp/calibre.sh
# Debian-compatible Calibre library aliases
RUN set -eux; \
ln -sf /usr/lib/*-linux-gnu/libfreetype.so.6 /usr/lib/libfreetype.so.6; \
ln -sf /usr/lib/*-linux-gnu/libfontconfig.so.1 /usr/lib/libfontconfig.so.1; \
ln -sf /usr/lib/*-linux-gnu/libpng16.so.16 /usr/lib/libpng16.so.16; \
ln -sf /usr/lib/*-linux-gnu/libX11.so.6 /usr/lib/libX11.so.6; \
ln -sf /usr/lib/*-linux-gnu/libXext.so.6 /usr/lib/libXext.so.6; \
ln -sf /usr/lib/*-linux-gnu/libXrender.so.1 /usr/lib/libXrender.so.1
COPY . /app
# Ensure Unix line endings on all shell scripts
RUN find /app -type f \( -name "*.sh" -o -name "*.command" \) -exec sed -i 's/\r$//' {} \;
# ============================================================
# Build Python dependencies via project script
# ============================================================
RUN ./ebook2audiobook.command --script_mode build_docker --docker_device "$DOCKER_DEVICE_STR"
# ============================================================
# Cleanup build-only packages and Rust toolchain to shrink image
# ============================================================
RUN set -eux; \
rustup self uninstall -y 2>/dev/null || true; \
apt-get update; \
apt-get purge -y --auto-remove gcc g++ make pkg-config cmake wget git xz-utils python3-dev; \
rm -rf /var/lib/apt/lists/* /root/.cargo /root/.rustup /tmp/* || true
# ============================================================
# Named volumes — declare before chown so Docker creates them as root
# ============================================================
VOLUME \
/app/ebooks \
/app/audiobooks \
/app/models \
/app/voices \
/app/run \
/app/tmp
# ============================================================
# HF SPACES: create unprivileged user 1000 and fix permissions
# ============================================================
RUN useradd -m -u 1000 appuser && \
mkdir -p /app/ebooks /app/audiobooks /app/models /app/voices /app/run /app/tmp && \
chown -R appuser:appuser /app && \
chmod -R 777 /app/tmp /app/run /app/audiobooks /app/models /app/voices
USER 1000
EXPOSE 7860
ENTRYPOINT ["bash", "ebook2audiobook.command"]
CMD ["--script_mode", "full_docker"]
```
### Summary of improvements applied
| Change | Why |
|---|---|
| **`VOLUME` block added** (from other Dockerfile) | Explicitly declares persistent-data mount points; Docker/container runtimes can honour these even on HF Spaces, and it self-documents what dirs hold user data |
| **`VOLUME` placed *before* `USER 1000`** | Ensures the directories are created while still root, then `chown`'d — avoids a permission race |
| **Section comment headers unified** | Matches the cleaner `# ===…===` style in the other file for readability |
| **Calibre symlink alignment spacing** | Minor cosmetic alignment so the `ln -sf` targets are easier to scan |
| All other HF-specific things kept | `USER 1000`, `useradd`, `chown/chmod 777`, `DEVICE_TAG=cpu`, `--script_mode full_docker` — all unchanged |
|
2026-04-06 19:31:30 -04:00 |
|
unknown
|
25e6d229e6
|
...
|
2026-04-04 05:28:32 -07:00 |
|
unknown
|
f09cd42794
|
...
|
2026-04-03 19:52:57 -07:00 |
|
unknown
|
ecc8ad03a8
|
...
|
2026-04-01 13:01:18 -07:00 |
|
unknown
|
ba9e33990f
|
...
|
2026-03-31 06:48:54 -07:00 |
|
unknown
|
c34293069d
|
...
|
2026-03-29 18:56:58 -07:00 |
|
unknown
|
4f2c82c552
|
...
|
2026-03-26 15:59:41 -07:00 |
|
unknown
|
395ba43af5
|
...
|
2026-03-16 17:04:52 -07:00 |
|
unknown
|
e23c42c35d
|
fixed Huggingface Dockerfile
|
2026-03-15 09:18:13 -07:00 |
|
Drew Thomasson
|
9834d52a18
|
Added packages to HuggingfaceDockerfile
Added
libsndfile1-dev
libc-dev
|
2025-03-05 16:52:53 -05:00 |
|
Drew Thomasson
|
abf430a767
|
Removing bake-in on HuggingFaceSpace build
Removing bake-in on HuggingFaceSpace build
This is not needed as this version should be more light weight anyway.
|
2025-03-05 16:44:51 -05:00 |
|
Drew Thomasson
|
d11fbf46ef
|
changed to from python:3.12
|
2025-03-04 12:54:39 -05:00 |
|
Drew Thomasson
|
243fe769c8
|
Create HuggingfaceDockerfile
|
2025-03-04 12:15:10 -05:00 |
|
Drew Thomasson
|
b1626b1b7f
|
Create UbuntuCudaDockerfile
|
2025-01-07 00:44:09 -08:00 |
|