44 lines
1.5 KiB
Docker
44 lines
1.5 KiB
Docker
# Backend Development Dockerfile
|
|
FROM python:3.12-slim
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
build-essential \
|
|
docker.io \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install uv
|
|
# Use IP address for proxy (cai.local may not resolve in Docker container)
|
|
ENV http_proxy=http://192.168.1.250:7897 https_proxy=http://192.168.1.250:7897
|
|
# Exclude localhost and container network from proxy
|
|
ENV no_proxy=localhost,127.0.0.1,0.0.0.0,frontend,gateway,langgraph,nginx,.local
|
|
# RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
# Try to install uv via official installer, fallback to pip if fails
|
|
RUN (curl -LsSf https://astral.sh/uv/install.sh | sh || pip install uv) && \
|
|
echo "uv installed at:" && \
|
|
which uv || echo "uv not found in PATH" && \
|
|
ls -la /root/.local/bin/ || echo "/root/.local/bin/ not found" && \
|
|
echo "uv version:" && \
|
|
uv --version || echo "uv command not working"
|
|
ENV PATH="/root/.local/bin:$PATH"
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy frontend source code
|
|
COPY backend ./backend
|
|
|
|
# Install dependencies with cache mount
|
|
RUN --mount=type=cache,target=/root/.cache/uv \
|
|
sh -c "cd backend && uv sync"
|
|
|
|
# Keep proxy for uv sync (Python package downloads may need proxy in China)
|
|
ENV http_proxy= https_proxy=
|
|
|
|
# Expose ports (gateway: 8001, langgraph: 2024)
|
|
EXPOSE 8001 2024
|
|
|
|
# Default command (can be overridden in docker-compose)
|
|
CMD ["sh", "-c", "uv run uvicorn src.gateway.app:app --host 0.0.0.0 --port 8001"]
|