|
1 | 1 | # Mohawk Inference Engine GUI - Production Docker Image |
2 | | -# Version: 2.1.0 |
| 2 | +# Version: 2.1.0 - Linux/ARM64 Optimized |
3 | 3 |
|
4 | 4 | FROM python:3.12-bookworm |
5 | 5 |
|
6 | 6 | # Set environment variables |
7 | | -ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1 |
| 7 | +ENV PYTHONDONTWRITEBYTECODE=1 \ |
| 8 | + PYTHONUNBUFFERED=1 \ |
| 9 | + PIP_NO_CACHE_DIR=1 \ |
| 10 | + PIP_DISABLE_PIP_VERSION_CHECK=1 \ |
| 11 | + DEBIAN_FRONTEND=noninteractive |
8 | 12 |
|
9 | 13 | # Set working directory |
10 | 14 | WORKDIR /app |
11 | 15 |
|
12 | | -# Install system dependencies (bookworm includes Mesa libraries natively) |
13 | | -RUN apt-get update && apt-get install -y gcc git libgl1 libegl1 libxkbcommon-x11-0 libdbus-1-3 && rm -rf /var/lib/apt/lists/* |
| 16 | +# Install system dependencies (Debian Bookworm compatible) |
| 17 | +# Includes build tools for ARM64 and service discovery support |
| 18 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 19 | + build-essential \ |
| 20 | + gcc \ |
| 21 | + git \ |
| 22 | + curl \ |
| 23 | + pkg-config \ |
| 24 | + libffi-dev \ |
| 25 | + libssl-dev \ |
| 26 | + libgl1 \ |
| 27 | + libegl1 \ |
| 28 | + libxkbcommon-x11-0 \ |
| 29 | + libdbus-1-3 \ |
| 30 | + avahi-daemon \ |
| 31 | + && rm -rf /var/lib/apt/lists/* |
14 | 32 |
|
15 | 33 | # Copy requirements first for better caching |
16 | 34 | COPY requirements.txt . |
17 | | -RUN pip install --no-cache-dir -r requirements.txt |
18 | | -RUN pip install --no-cache-dir "fastapi>=0.104.0" "uvicorn>=0.24.0" "requests>=2.31.0" |
| 35 | + |
| 36 | +# Install Python dependencies |
| 37 | +# Use --no-build-isolation for compatibility with ARM64 |
| 38 | +RUN pip install --upgrade pip setuptools wheel && \ |
| 39 | + pip install --no-cache-dir -r requirements.txt && \ |
| 40 | + pip install --no-cache-dir \ |
| 41 | + "fastapi>=0.104.0" \ |
| 42 | + "uvicorn>=0.24.0" \ |
| 43 | + "requests>=2.31.0" |
19 | 44 |
|
20 | 45 | # Copy application code |
21 | 46 | COPY mohawk_gui/ ./mohawk_gui/ |
22 | 47 | COPY prototype/ ./prototype/ |
23 | 48 |
|
24 | 49 | # Create non-root user for security |
25 | | -RUN groupadd mohawk && useradd -r -g mohawk mohawk |
26 | | -USER mohawk |
| 50 | +RUN groupadd mohawk && useradd -r -g mohawk mohawk && \ |
| 51 | + chown -R mohawk:mohawk /app |
27 | 52 |
|
28 | 53 | # Expose ports |
29 | 54 | EXPOSE 8003 8443 |
30 | 55 |
|
31 | | -# Health check |
32 | | -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 CMD python -c "import sys; sys.exit(0 if __import__('mohawk_gui').main else 1)" || exit 1 |
| 56 | +# Health check with timeout and retries |
| 57 | +HEALTHCHECK --interval=10s --timeout=5s --start-period=5s --retries=3 \ |
| 58 | + CMD curl -f http://localhost:8003/health || exit 1 |
33 | 59 |
|
34 | | -# Default command |
35 | | -CMD ["python", "mohawk_gui/main.py"] |
| 60 | +# Default command - run GUI backend with service discovery |
| 61 | +CMD ["python", "-m", "uvicorn", "prototype.gui_backend:app", "--host", "0.0.0.0", "--port", "8003"] |
0 commit comments