-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.gui.light
More file actions
83 lines (64 loc) · 2.32 KB
/
Copy pathDockerfile.gui.light
File metadata and controls
83 lines (64 loc) · 2.32 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
# Compileo GUI Dockerfile - Lightweight Version
# Uses slim Python base instead of heavy CUDA image since GUI doesn't need GPU
FROM python:3.12-slim AS builder
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy requirements files
COPY requirements.txt .
COPY requirements-gui.txt .
COPY pyproject.toml .
# Install Python dependencies
# We filter out torch and other heavy backend libs from requirements.txt if present
# But install requirements-gui.txt fully
RUN pip install --upgrade pip setuptools wheel && \
# Create a filtered requirements file that excludes heavy ML libs not needed for GUI
grep -vE "torch|nvidia|cuda|flash-attn" requirements.txt > requirements-light.txt && \
pip install -r requirements-light.txt && \
pip install -r requirements-gui.txt
# Copy source code
COPY src/ ./src/
# Production stage
FROM python:3.12-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
DEBIAN_FRONTEND=noninteractive
# Install minimal runtime dependencies
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Create non-root user
RUN useradd --create-home --shell /bin/bash --uid 1001 compileo
# Add user local bin to PATH
ENV PATH="/home/compileo/.local/bin:${PATH}"
# Copy Python packages from builder stage
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application code
COPY --from=builder /app/src ./src
# Create necessary directories and set permissions
RUN mkdir -p data uploads test_outputs plugins && \
chown -R compileo:compileo /app
# Switch to non-root user
USER compileo
# Expose port
EXPOSE 8501
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \
CMD curl -f http://localhost:8501/healthz || exit 1
# Run the GUI
CMD ["streamlit", "run", "src/compileo/features/gui/main.py", "--server.port", "8501", "--server.address", "0.0.0.0"]