|
1 | 1 | # Mohawk Inference Engine GUI - Production Docker Image |
2 | 2 | # Version: 2.1.0 |
3 | | -# Cross-platform: Windows, Linux, macOS |
4 | 3 |
|
5 | | -FROM python:3.11-slim-bookworm |
| 4 | +FROM python:3.14-slim |
6 | 5 |
|
7 | | -# Set environment variables for production |
8 | | -ENV PYTHONDONTWRITEBYTECODE=1 \ |
9 | | - PYTHONUNBUFFERED=1 \ |
10 | | - PIP_NO_CACHE_DIR=1 \ |
11 | | - PIP_DISABLE_PIP_VERSION_CHECK=1 \ |
12 | | - DEBIAN_FRONTEND=noninteractive |
| 6 | +# Set environment variables |
| 7 | +ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1 |
13 | 8 |
|
14 | 9 | # Set working directory |
15 | 10 | WORKDIR /app |
16 | 11 |
|
17 | 12 | # Install system dependencies |
18 | | -RUN apt-get update && apt-get install -y --no-install-recommends \ |
19 | | - # System libraries for PyQt6 |
20 | | - libgl1-mesa-glx \ |
21 | | - libxkbcommon-x11-0 \ |
22 | | - libdbus-1-3 \ |
23 | | - libegl1-mesa \ |
24 | | - # Build tools |
25 | | - gcc \ |
26 | | - git \ |
27 | | - && rm -rf /var/lib/apt/lists/* |
| 13 | +RUN apt-get update && apt-get install -y gcc git libgl1-mesa-glx libglib2.0-0 libxkbcommon-x11-0 libdbus-1-3 && rm -rf /var/lib/apt/lists/* |
28 | 14 |
|
29 | | -# Install Python dependencies |
| 15 | +# Copy requirements first for better caching |
30 | 16 | COPY requirements.txt . |
31 | 17 | RUN pip install --no-cache-dir -r requirements.txt |
32 | 18 |
|
33 | 19 | # Copy application code |
34 | 20 | COPY mohawk_gui/ ./mohawk_gui/ |
35 | 21 |
|
36 | | -# Create non-root user for security (production best practice) |
37 | | -RUN groupadd mohawk && \ |
38 | | - useradd -r -g mohawk mohawk && \ |
39 | | - chown -R mohawk:mohawk /app |
| 22 | +# Create non-root user for security |
| 23 | +RUN groupadd mohawk && useradd -r -g mohawk mohawk |
40 | 24 | USER mohawk |
41 | 25 |
|
42 | | -# Create directories for runtime data |
43 | | -RUN mkdir -p /app/certs /app/logs /app/models && \ |
44 | | - chown -R mohawk:mohawk /app/certs /app/logs /app/models |
45 | | - |
46 | | -# Copy configuration template |
47 | | -COPY mohawk_gui/config.toml ./config.toml |
48 | | - |
49 | 26 | # Expose ports |
50 | 27 | EXPOSE 8003 8443 |
51 | 28 |
|
52 | 29 | # Health check |
53 | | -HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ |
54 | | - CMD python -c "import sys; sys.exit(0)" || exit 1 |
55 | | - |
56 | | -# Default command - can be overridden at runtime |
57 | | -CMD ["python", "mohawk_gui/main.py", "--host", "0.0.0.0", "--port", "8003"] |
| 30 | +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 |
58 | 31 |
|
59 | | -# ============================================================================= |
60 | | -# Multi-stage build for smaller image (optional) |
61 | | -# ============================================================================= |
62 | | -# FROM debian:bookworm-slim AS base |
63 | | -# RUN apt-get update && apt-get install -y \ |
64 | | -# python3.11 \ |
65 | | -# python3-pip \ |
66 | | -# libgl1-mesa-glx \ |
67 | | -# libxkbcommon-x11-0 \ |
68 | | -# libdbus-1-3 \ |
69 | | -# && rm -rf /var/lib/apt/lists/* |
70 | | -# |
71 | | -# WORKDIR /app |
72 | | -# COPY --from=python:3.11-slim-bookworm /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/ |
| 32 | +# Default command |
| 33 | +CMD ["python", "mohawk_gui/main.py"] |
0 commit comments