1- FROM ubuntu:24.04 AS builder
21
3- ENV DEBIAN_FRONTEND=noninteractive
2+ FROM ubuntu:24.04 AS build
3+
4+ ARG DEBIAN_FRONTEND=noninteractive
5+
46RUN apt-get update && apt-get install -y --no-install-recommends \
5- g++ \
67 python3 \
78 python3-pip \
89 python3-venv \
9- curl \
10- ca-certificates \
11- && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
12- && apt-get install -y --no-install-recommends nodejs \
10+ git \
1311 && rm -rf /var/lib/apt/lists/*
1412
15- WORKDIR /build
16- COPY . .
17- RUN g++ -std=c++17 -O2 -I. -Iinclude -o quadtrix main.cpp
18- RUN cd frontend \
19- && npm ci \
20- && npm run build
21- RUN python3 -m venv /venv \
22- && /venv/bin/pip install --upgrade pip --quiet \
23- && /venv/bin/pip install -r backend/requirements.txt --quiet
13+ WORKDIR /app
2414
25- ARG BASE_IMAGE=ubuntu:24.04
26- FROM ${BASE_IMAGE:-ubuntu:24.04} AS runtime
15+ RUN python3 -m venv /app/venv
16+ ENV PATH= "/app/venv/bin:$PATH"
2717
28- LABEL org.opencontainers.image.title="Quadtrix.cpp"
29- LABEL org.opencontainers.image.description="Local LLM with C++/PyTorch backends and React UI"
30- LABEL org.opencontainers.image.source="https://github.com/Eamon2009/Quadtrix.cpp"
31- LABEL org.opencontainers.image.version="1.1.0"
32- LABEL org.opencontainers.image.licenses="MIT"
18+ RUN pip install --no-cache-dir torch torchvision torchaudio \
19+ --index-url https://download.pytorch.org/whl/cu129
3320
34- ENV DEBIAN_FRONTEND=noninteractive \
35- PYTHONUNBUFFERED=1 \
36- PATH= "/venv/bin:$PATH"
21+ FROM ubuntu:24.04 AS runtime
22+
23+ ARG DEBIAN_FRONTEND=noninteractive
3724
38- # Runtime system packages
3925RUN apt-get update && apt-get install -y --no-install-recommends \
4026 python3 \
41- supervisor \
42- curl \
43- ca-certificates \
44- && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
45- && apt-get install -y --no-install-recommends nodejs \
46- && npm install -g serve --quiet \
27+ libgomp1 \
4728 && rm -rf /var/lib/apt/lists/*
4829
4930WORKDIR /app
50- COPY --from=builder /venv /venv
51- COPY --from=builder /build/quadtrix /app/quadtrix
52- COPY --from=builder /build/frontend/dist /app/frontend/dist
53- COPY --from=builder /build/backend /app/backend
54- COPY --from=builder /build/engine /app/engine
55- COPY supervisord.conf /etc/supervisor/conf.d/quadtrix.conf
56- COPY docker-entrypoint.sh /app/entrypoint.sh
5731
58- RUN chmod +x /app/entrypoint.sh /app/quadtrix \
59- && mkdir -p /var/log/supervisor /app/models
60- VOLUME ["/app/models" ]
61- ENV TORCH_CHECKPOINT_PATH=/app/models/best_model.pt \
62- GPT_MODEL_PATH=/app/models/best_model.bin \
63- API_PORT=3001 \
64- CORS_ORIGINS=http://localhost:8080 \
65- LOG_LEVEL=INFO \
66- MAX_SESSIONS=1000 \
67- SESSION_TTL_HOURS=24
68- EXPOSE 3001 8080
32+ COPY --from=build /app/venv /app/venv
33+ COPY . .
34+
35+ ENV PATH="/app/venv/bin:$PATH"
36+ ENV PYTHONUNBUFFERED=1
6937
70- ENTRYPOINT ["/app/entrypoint.sh" ]
38+ ENTRYPOINT ["python3" , "engine/main.py" ]
0 commit comments