ACE-Step-CPU / Dockerfile
Nekochu's picture
remove torchcodec (needs FFmpeg 5.x), keep soundfile backend
63d7cb8
raw
history blame
3.34 kB
FROM ubuntu:22.04 AS builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake git ca-certificates libopenblas-dev pkg-config \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Clone acestep.cpp and init submodules
RUN git clone --depth 1 https://github.com/ServeurpersoCom/acestep.cpp.git . \
&& git submodule update --init --depth 1
# Build CPU-only with BLAS (-j1 to avoid OOM on HF free tier)
RUN mkdir build && cd build \
&& cmake .. -DGGML_BLAS=ON \
&& cmake --build . --config Release -j1
# Stage built artifacts into a clean directory for COPY
RUN mkdir -p /artifacts \
&& cp /build/build/ace-server /artifacts/ \
&& cp /build/build/ace-lm /artifacts/ \
&& cp /build/build/ace-synth /artifacts/ \
&& (cp -a /build/build/lib*.so* /artifacts/ 2>/dev/null || true)
# ---------------------------------------------------------------------------
# Runtime image
# ---------------------------------------------------------------------------
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
libopenblas0 libgomp1 ca-certificates git libsndfile1 \
python3 python3-pip curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Copy built binaries and shared libraries
COPY --from=builder /artifacts/ /app/
# Ensure GGML backend .so files are findable at runtime
ENV LD_LIBRARY_PATH=/app:${LD_LIBRARY_PATH}
# Make binaries executable
RUN chmod +x /app/ace-server /app/ace-lm /app/ace-synth
# Create model and adapter directories
RUN mkdir -p /app/models /app/adapters /app/outputs
# Download GGUF models at build time (NOT via Git LFS)
# --fail ensures curl returns non-zero on HTTP errors (catches 404)
# XL DiT turbo Q4_K_M (~2.8GB) - best quality/size for CPU
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/acestep-v15-xl-turbo-Q4_K_M.gguf \
"https://huggingface.co/Serveurperso/ACE-Step-1.5-GGUF/resolve/main/acestep-v15-xl-turbo-Q4_K_M.gguf"
# LM 4B Q5_K_M (~2.9GB) - best quality
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/acestep-5Hz-lm-4B-Q5_K_M.gguf \
"https://huggingface.co/Serveurperso/ACE-Step-1.5-GGUF/resolve/main/acestep-5Hz-lm-4B-Q5_K_M.gguf"
# Text encoder Q8_0 (~0.75GB)
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/Qwen3-Embedding-0.6B-Q8_0.gguf \
"https://huggingface.co/Serveurperso/ACE-Step-1.5-GGUF/resolve/main/Qwen3-Embedding-0.6B-Q8_0.gguf"
# VAE BF16 (~0.32GB) - always BF16, quality-critical
RUN curl -fL --retry 3 --retry-delay 5 -o /app/models/vae-BF16.gguf \
"https://huggingface.co/Serveurperso/ACE-Step-1.5-GGUF/resolve/main/vae-BF16.gguf"
# Install Python deps for Gradio UI + training
RUN pip3 install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu \
"gradio[mcp]==5.29.0" requests torch safetensors \
transformers>=4.51.0 peft>=0.18.0 accelerate>=1.12.0 \
loguru torchaudio diffusers lightning numpy tensorboard soundfile
# Clone ACE-Step repo for training module
RUN git clone --depth 1 https://github.com/ace-step/ACE-Step-1.5 /app/ace-step-source
# Copy application files
COPY app.py /app/app.py
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
# HF Spaces expects port 7860
EXPOSE 7860
CMD ["/app/start.sh"]