Merge pull request #15 from sammcj/docker
This commit is contained in:
+58
@@ -0,0 +1,58 @@
|
|||||||
|
FROM nvidia/cuda:12.6.0-runtime-ubuntu22.04 AS base
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
PORT=7865 \
|
||||||
|
HF_HUB_ENABLE_HF_TRANSFER=1 \
|
||||||
|
DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Install Python and system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
python3.10 \
|
||||||
|
python3-pip \
|
||||||
|
python3-venv \
|
||||||
|
python3-dev \
|
||||||
|
build-essential \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& ln -s /usr/bin/python3 /usr/bin/python
|
||||||
|
|
||||||
|
# Create and activate virtual environment
|
||||||
|
RUN python -m venv /opt/venv
|
||||||
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
|
|
||||||
|
# Create a non-root user to run the application
|
||||||
|
RUN useradd -m -u 1001 appuser
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Clone the repository
|
||||||
|
RUN git clone https://github.com/ace-step/ACE-Step.git .
|
||||||
|
|
||||||
|
# Install specific PyTorch version compatible with CUDA 12.2
|
||||||
|
RUN pip3 install --no-cache-dir --upgrade pip && \
|
||||||
|
pip3 install --no-cache-dir hf_transfer peft && \
|
||||||
|
pip3 install --no-cache-dir -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu126
|
||||||
|
|
||||||
|
# Change ownership of app files to appuser
|
||||||
|
RUN chown -R appuser:appuser /app
|
||||||
|
|
||||||
|
# Switch to non-root user
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
# Expose the port the app runs on
|
||||||
|
EXPOSE 7865
|
||||||
|
|
||||||
|
VOLUME [ "/app/checkpoints", "/app/outputs", "/app/logs" ]
|
||||||
|
|
||||||
|
# Set healthcheck
|
||||||
|
HEALTHCHECK --interval=60s --timeout=10s --start-period=5s --retries=5 \
|
||||||
|
CMD curl -f http://localhost:7865/ || exit 1
|
||||||
|
|
||||||
|
# Command to run the application with GPU support
|
||||||
|
CMD ["python3", "app.py", "--server_name", "0.0.0.0", "--bf16", "true"]
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
services:
|
||||||
|
&name ace-step:
|
||||||
|
build:
|
||||||
|
context: https://github.com/ace-step/ACE-Step.git
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: *name
|
||||||
|
hostname: *name
|
||||||
|
stop_grace_period: 2s
|
||||||
|
ports:
|
||||||
|
- "7865:7865"
|
||||||
|
volumes:
|
||||||
|
- ace-step-checkpoints:/app/checkpoints
|
||||||
|
- ace-step-outputs:/app/outputs
|
||||||
|
- ace-step-logs:/app/exps/logs
|
||||||
|
# command: python app.py --server_name 0.0.0.0 --port 7865 --share False --bf16 True --torch_compile True --device-id 0
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:7865/"]
|
||||||
|
interval: 60s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 30
|
||||||
|
start_period: 3s
|
||||||
|
restart: unless-stopped
|
||||||
|
runtime: nvidia
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- driver: nvidia
|
||||||
|
count: all
|
||||||
|
capabilities: ["compute", "utility", "graphics", "video"]
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
ace-step-checkpoints:
|
||||||
|
name: ace-step-checkpoints
|
||||||
|
ace-step-outputs:
|
||||||
|
name: ace-step-outputs
|
||||||
|
ace-step-logs:
|
||||||
|
name: ace-step-logs
|
||||||
Reference in New Issue
Block a user