-
-
Notifications
You must be signed in to change notification settings - Fork 97
Expand file tree
/
Copy pathDockerfile
More file actions
146 lines (128 loc) · 4.02 KB
/
Dockerfile
File metadata and controls
146 lines (128 loc) · 4.02 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# Dockerfile for AI Runner - supports both headless server and GUI modes
# Provides HTTP API for LLM, Art generation, TTS, STT, and Vision
# Can also run full PySide6 GUI with X11 forwarding
#
# Usage:
# GUI mode: docker compose run --rm airunner
# Headless mode: docker compose run --rm airunner --headless
FROM nvidia/cuda:12.9.1-devel-ubuntu24.04
# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies including X11/Qt requirements for GUI
RUN apt-get update && apt-get install -y \
software-properties-common \
curl \
wget \
git \
build-essential \
cmake \
pkg-config \
libprotobuf-dev \
protobuf-compiler \
mecab \
libmecab-dev \
mecab-ipadic-utf8 \
ffmpeg \
libsndfile1 \
portaudio19-dev \
# PulseAudio for audio
pulseaudio \
libasound2-dev \
# Install ALL Qt6 WebEngine dependencies via the package manager
# This pulls in all required libraries for QtWebEngine
libnss3 \
libxslt1.1 \
libxkbfile1 \
# X11 and XCB libraries
libx11-xcb1 \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-xfixes0 \
libxcb-xinerama0 \
libxkbcommon-x11-0 \
# OpenGL
libegl1 \
libgl1 \
libgles2 \
# Additional GUI deps
libfontconfig1 \
libdbus-1-3 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libxtst6 \
libdrm2 \
libgbm1 \
libxss1 \
libcups2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
# Clipboard support
xclip \
# pyautogui dependencies for computer use / desktop automation
python3-tk \
python3-dev \
scrot \
xdotool \
gnome-screenshot \
&& rm -rf /var/lib/apt/lists/*
# Install Python 3.13 from deadsnakes PPA (including tkinter for pyautogui)
RUN add-apt-repository ppa:deadsnakes/ppa -y && \
apt-get update && \
apt-get install -y \
python3.13 \
python3.13-venv \
python3.13-dev \
python3.13-tk \
&& rm -rf /var/lib/apt/lists/*
# Install pip for Python 3.13
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.13
# Create virtual environment
RUN python3.13 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Upgrade pip
RUN pip install --upgrade pip setuptools wheel
# Build llama-cpp-python from source with CUDA (no prebuilt cp313 wheels)
# GGML_CUDA enables GPU acceleration; set arch for RTX 5080 (SM90 class)
ENV CMAKE_ARGS="-DGGML_CUDA=on -DGGML_CUDA_ARCHITECTURES=90" \
FORCE_CMAKE=1
RUN pip install --no-binary=:all: --no-cache-dir "llama-cpp-python==0.3.16"
# Set working directory
WORKDIR /app
# Copy project files
COPY setup.py pyproject.toml README.md ./
COPY src/ ./src/
# Install airunner with all dependencies including computer_use
RUN pip install -e ".[all_dev,computer_use]"
# Create non-root user for running the container
# The UID/GID will be overridden by docker-compose user: directive
RUN groupadd -g 1000 airunner && \
useradd -u 1000 -g airunner -m -s /bin/bash airunner && \
mkdir -p /home/airunner/.local/share/airunner && \
mkdir -p /home/airunner/.cache/huggingface && \
chown -R airunner:airunner /home/airunner && \
chown -R airunner:airunner /app && \
chown -R airunner:airunner /opt/venv
# Copy entrypoint script
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Environment variables
ENV PYTHONUNBUFFERED=1
ENV AIRUNNER_ENVIRONMENT=production
ENV HOME=/home/airunner
ENV HF_HOME=/home/airunner/.cache/huggingface
ENV AIRUNNER_DATA_DIR=/home/airunner/.local/share/airunner
# Expose the API port (used in headless mode)
EXPOSE 8080
# Health check for headless mode (will fail gracefully in GUI mode)
HEALTHCHECK --interval=30s --timeout=10s --start-period=180s --retries=3 \
CMD curl -f http://localhost:8080/health || exit 0
# Use entrypoint script to handle GUI vs headless
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
# Default to GUI mode (no arguments = GUI)
CMD []