forked from lllyasviel/FramePack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (51 loc) · 1.47 KB
/
Copy pathDockerfile
File metadata and controls
66 lines (51 loc) · 1.47 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
56
57
58
59
60
61
62
63
64
65
66
# FramePack-FastAPI with External Model Mount
FROM nvidia/cuda:12.1-devel-ubuntu22.04
# Install system dependencies
RUN apt-get update && apt-get install -y \
python3.10 \
python3.10-dev \
python3-pip \
curl \
git \
build-essential \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Create symlink for python
RUN ln -s /usr/bin/python3.10 /usr/bin/python
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Set working directory
WORKDIR /app
# Copy dependency files
COPY pyproject.toml requirements.txt ./
# Create virtual environment and install dependencies
RUN uv venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Install Python dependencies
RUN uv pip install --no-cache -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p outputs/images temp_queue_images loras
# Create model mount points
RUN mkdir -p /app/hf_download
VOLUME ["/app/hf_download"]
# Set environment variables
ENV PYTHONPATH="/app:$PYTHONPATH"
ENV PYTHONUNBUFFERED=1
ENV HF_HOME="/app/hf_download"
ENV TRANSFORMERS_CACHE="/app/hf_download"
ENV HF_DATASETS_CACHE="/app/hf_download"
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/docs || exit 1
# Start command
CMD ["uvicorn", "api.api:app", "--host", "0.0.0.0", "--port", "8000"]