first commit
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
# Use Python 3.12 as the base image (satisfies requires-python >=3.12).
|
||||
# Force the amd64 architecture to obtain an available `cadquery-ocp` wheel; Linux aarch64 has no official wheel.
|
||||
FROM --platform=linux/amd64 python:3.12-slim
|
||||
|
||||
# Set the working directory.
|
||||
WORKDIR /app
|
||||
|
||||
# Set environment variables.
|
||||
ENV PYTHONPATH=/app
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN set -e; . /etc/os-release; \
|
||||
codename="${VERSION_CODENAME}"; \
|
||||
printf 'deb https://mirrors.ustc.edu.cn/debian/ %s main contrib non-free non-free-firmware\n' "$codename" > /etc/apt/sources.list; \
|
||||
printf 'deb https://mirrors.ustc.edu.cn/debian/ %s-updates main contrib non-free non-free-firmware\n' "$codename" >> /etc/apt/sources.list; \
|
||||
printf 'deb https://mirrors.ustc.edu.cn/debian-security %s-security main contrib non-free non-free-firmware\n' "$codename" >> /etc/apt/sources.list; \
|
||||
printf 'deb https://mirrors.ustc.edu.cn/debian/ %s-backports main contrib non-free non-free-firmware\n' "$codename" >> /etc/apt/sources.list
|
||||
|
||||
# Install system dependencies, including OpenGL runtime libraries for libGL.so.1.
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
git \
|
||||
# OpenGL/GLX/EGL runtime libraries commonly needed by VTK/Qt/pyvista.
|
||||
libgl1 \
|
||||
libglib2.0-0 \
|
||||
libsm6 \
|
||||
libxext6 \
|
||||
libxrender1 \
|
||||
libglu1-mesa \
|
||||
libglx-mesa0 \
|
||||
libegl1 \
|
||||
# Headless rendering with Xvfb.
|
||||
xvfb \
|
||||
xauth \
|
||||
libx11-6 \
|
||||
libxkbcommon0 \
|
||||
fonts-dejavu-core \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV TMPDIR=/app/tmp
|
||||
RUN mkdir -p /app/tmp && chmod 1777 /app/tmp
|
||||
|
||||
|
||||
# Copy only exported requirements to maximize layer caching.
|
||||
COPY requirements.txt ./
|
||||
|
||||
# requirements.txt is automatically exported from uv.lock in pre-commit.
|
||||
RUN export PIP_INDEX_URL="https://mirrors.ustc.edu.cn/pypi/web/simple" \
|
||||
&& pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
ENV DISPLAY=:99
|
||||
ENV PYVISTA_OFF_SCREEN=true
|
||||
ENV PYVISTA_USE_PANEL=false
|
||||
ENV QT_QPA_PLATFORM=offscreen
|
||||
ENV MPLBACKEND=Agg
|
||||
ENV LIBGL_ALWAYS_SOFTWARE=1
|
||||
|
||||
# Copy project files.
|
||||
COPY . .
|
||||
|
||||
# Create required directories.
|
||||
RUN mkdir -p /app/data /app/logs /app/workspace
|
||||
|
||||
# Set permissions.
|
||||
RUN chmod +x /app/start_caddesigner_api.py
|
||||
|
||||
# Copy and configure the entrypoint script to provide Xvfb headless rendering for the API service.
|
||||
COPY docker/entrypoint.sh /app/entrypoint.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
|
||||
# Expose the API port.
|
||||
EXPOSE 8000
|
||||
|
||||
# The entrypoint script starts Xvfb and then executes the final command.
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
# Start the API by default.
|
||||
@@ -0,0 +1,17 @@
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
WORKDIR /app/frontend
|
||||
|
||||
ENV CI=true
|
||||
|
||||
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
||||
|
||||
RUN corepack enable \
|
||||
&& corepack prepare pnpm@10.29.3 --activate \
|
||||
&& pnpm install --frozen-lockfile
|
||||
|
||||
COPY frontend/ ./
|
||||
|
||||
EXPOSE 7860
|
||||
|
||||
CMD ["sh", "-lc", "pnpm dev --host 0.0.0.0 --port 7860 --strictPort"]
|
||||
@@ -0,0 +1,21 @@
|
||||
services:
|
||||
# Start Redis only for local development integration.
|
||||
simplecad_redis_dev:
|
||||
image: redis:7-alpine
|
||||
container_name: simplecad_redis_dev
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9736:9736"
|
||||
volumes:
|
||||
- simplecad_redis_data:/data/simplecad_redis
|
||||
- ./redis.conf:/usr/local/etc/redis/redis.conf:ro
|
||||
command: redis-server /usr/local/etc/redis/redis.conf
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-p", "9736", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
volumes:
|
||||
simplecad_redis_data:
|
||||
driver: local
|
||||
@@ -0,0 +1,88 @@
|
||||
services:
|
||||
# Redis service.
|
||||
simplecad_redis:
|
||||
image: redis:7-alpine
|
||||
container_name: simplecad_redis
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "9736:9736"
|
||||
volumes:
|
||||
- simplecad_redis_data:/data/simplecad_redis
|
||||
- ./redis.conf:/usr/local/etc/redis/redis.conf:ro
|
||||
command: redis-server /usr/local/etc/redis/redis.conf
|
||||
networks:
|
||||
- simplecad_network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-p", "9736", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
# API service.
|
||||
simplecad_api:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile
|
||||
platform: linux/amd64
|
||||
container_name: simplecad_api
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8000:8000"
|
||||
env_file:
|
||||
- ${CADDESIGNER_DOCKER_ENV_FILE:-.env}
|
||||
environment:
|
||||
- REDIS_HOST=simplecad_redis
|
||||
- REDIS_PORT=9736
|
||||
- REDIS_DB=0
|
||||
- LOG_LEVEL=WARNING
|
||||
volumes:
|
||||
- app_data:/app/data
|
||||
- app_logs:/app/logs
|
||||
- app_workspace:/app/workspace
|
||||
- ./provider.json:/app/config/provider.json:ro
|
||||
depends_on:
|
||||
simplecad_redis:
|
||||
condition: service_healthy
|
||||
command: ["python", "start_caddesigner_api.py", "--host", "0.0.0.0", "--port", "8000", "--working-dir", "/app/workspace"]
|
||||
networks:
|
||||
- simplecad_network
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 40s
|
||||
# Linux compatibility: allow the container to resolve the host machine domain.
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# React Web UI service.
|
||||
simplecad_webui:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: docker/Dockerfile.frontend
|
||||
container_name: simplecad_webui
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "7860:7860"
|
||||
environment:
|
||||
- CADDESIGNER_API_PROXY_TARGET=http://simplecad_api:8000
|
||||
depends_on:
|
||||
simplecad_api:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- simplecad_network
|
||||
|
||||
volumes:
|
||||
simplecad_redis_data:
|
||||
driver: local
|
||||
app_data:
|
||||
driver: local
|
||||
app_logs:
|
||||
driver: local
|
||||
app_workspace:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
simplecad_network:
|
||||
driver: bridge
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env sh
|
||||
set -e
|
||||
|
||||
export DISPLAY=:99
|
||||
rm -f /tmp/.X99-lock
|
||||
|
||||
if ! pgrep -x Xvfb >/dev/null 2>&1; then
|
||||
echo "[entrypoint] Starting Xvfb on $DISPLAY"
|
||||
Xvfb $DISPLAY -screen 0 1920x1080x24 -nolisten tcp &
|
||||
fi
|
||||
|
||||
# Wait for Xvfb to become ready.
|
||||
sleep 0.5
|
||||
|
||||
# Execute the passed command.
|
||||
exec "$@"
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# Redis configuration
|
||||
REDIS_DB=0
|
||||
REDIS_PASSWORD=
|
||||
REDIS_HOST=localhost
|
||||
REDIS_PORT=9736
|
||||
|
||||
# Storage directories
|
||||
CONTEXT_DIR=workspace/data/contexts
|
||||
CONTEXT_AUTO_SUMMARIZE_TRIGGER=1000000
|
||||
SKETCH_DIR=workspace/data/sketches
|
||||
|
||||
# Logging
|
||||
LOG_DIR=workspace/agent_logs
|
||||
LOG_LEVEL=WARNING
|
||||
|
||||
# Langfuse configuration, optional
|
||||
LANGFUSE_SECRET_KEY=your_langfuse_secret_key
|
||||
LANGFUSE_PUBLIC_KEY=your_langfuse_public_key
|
||||
LANGFUSE_BASE_URL=https://cloud.langfuse.com
|
||||
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"volc_engine": [
|
||||
{
|
||||
"model_name": "deepseek-v3-250324",
|
||||
"api_keys": [
|
||||
"your_keys"
|
||||
],
|
||||
"base_url": "https://ark.cn-beijing.volces.com/api/v3/",
|
||||
"max_retries": 3,
|
||||
"retry_delay": 1
|
||||
},
|
||||
{
|
||||
"model_name": "doubao-1-5-pro-32k-250115",
|
||||
"api_keys": [
|
||||
"your_keys"
|
||||
],
|
||||
"base_url": "https://ark.cn-beijing.volces.com/api/v3/",
|
||||
"max_retries": 3,
|
||||
"retry_delay": 1
|
||||
}
|
||||
],
|
||||
"openrouter": [
|
||||
{
|
||||
"model_name": "z-ai/glm-5",
|
||||
"api_keys": [
|
||||
"your_keys"
|
||||
],
|
||||
"base_url": "https://openrouter.ai/api/v1"
|
||||
},
|
||||
{
|
||||
"model_name": "google/gemini-3.1-pro-preview",
|
||||
"api_keys": [
|
||||
"your_keys"
|
||||
],
|
||||
"base_url": "https://openrouter.ai/api/v1"
|
||||
},
|
||||
{
|
||||
"model_name": "anthropic/claude-sonnet-4.6",
|
||||
"api_keys": [
|
||||
"your_keys"
|
||||
],
|
||||
"base_url": "https://openrouter.ai/api/v1"
|
||||
},
|
||||
{
|
||||
"model_name": "google/gemini-3-flash-preview",
|
||||
"api_keys": [
|
||||
"your_keys"
|
||||
],
|
||||
"base_url": "https://openrouter.ai/api/v1"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
# Redis configuration file.
|
||||
# Basic settings.
|
||||
bind 0.0.0.0
|
||||
port 9736
|
||||
timeout 0
|
||||
tcp-keepalive 300
|
||||
|
||||
# Memory management.
|
||||
maxmemory 256mb
|
||||
maxmemory-policy allkeys-lru
|
||||
|
||||
# Persistence settings.
|
||||
save 900 1
|
||||
save 300 10
|
||||
save 60 10000
|
||||
stop-writes-on-bgsave-error yes
|
||||
rdbcompression yes
|
||||
rdbchecksum yes
|
||||
dbfilename dump_backend_redis.rdb
|
||||
dir /data/simplecad_redis
|
||||
|
||||
# AOF settings.
|
||||
appendonly yes
|
||||
appendfilename "appendonly.aof"
|
||||
appendfsync everysec
|
||||
no-appendfsync-on-rewrite no
|
||||
auto-aof-rewrite-percentage 100
|
||||
auto-aof-rewrite-min-size 64mb
|
||||
|
||||
# Logging settings.
|
||||
loglevel notice
|
||||
logfile ""
|
||||
|
||||
# Security settings.
|
||||
# requirepass your_redis_password_here # Uncomment and set a password.
|
||||
|
||||
# Performance optimization.
|
||||
tcp-backlog 511
|
||||
databases 16
|
||||
hash-max-ziplist-entries 512
|
||||
hash-max-ziplist-value 64
|
||||
list-max-ziplist-size -2
|
||||
list-compress-depth 0
|
||||
set-max-intset-entries 512
|
||||
zset-max-ziplist-entries 128
|
||||
zset-max-ziplist-value 64
|
||||
activerehashing yes
|
||||
client-output-buffer-limit normal 0 0 0
|
||||
client-output-buffer-limit slave 256mb 64mb 60
|
||||
client-output-buffer-limit pubsub 32mb 8mb 60
|
||||
hz 10
|
||||
aof-rewrite-incremental-fsync yes
|
||||
Reference in New Issue
Block a user