-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (42 loc) · 1.26 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (42 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# CLAP2Diffusion Docker Image
FROM pytorch/pytorch:2.1.0-cuda11.8-cudnn8-runtime
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
wget \
curl \
ffmpeg \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code (excluding large files)
COPY models/ ./models/
COPY scripts/ ./scripts/
COPY app/ ./app/
COPY configs/ ./configs/
COPY utils/ ./utils/
# Create necessary directories
RUN mkdir -p /app/outputs /app/temp /app/logs /app/checkpoints /app/data
# Create non-root user
RUN useradd -m -u 1000 -s /bin/bash appuser && \
chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Set environment variables
ENV PYTHONPATH=/app
ENV CUDA_VISIBLE_DEVICES=0
ENV GRADIO_SERVER_NAME=0.0.0.0
ENV GRADIO_SERVER_PORT=7860
# Expose port for Gradio
EXPOSE 7860
# Note: checkpoints and data should be mounted via volumes, not copied
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/ || exit 1
# Run the application
CMD ["python", "app/gradio_app.py"]