Some checks failed
Build Images / build-server-docker (push) Failing after 7s
Build Images / build-mcp-docker (push) Has been skipped
Build Images / build-agents-docker (push) Has been skipped
Build Images / build-frontend-docker (push) Has been skipped
Build Images / build-server-k8s (push) Has been skipped
Build Images / build-mcp-k8s (push) Has been skipped
Build Images / build-agents-k8s (push) Has been skipped
Build Images / build-frontend-k8s (push) Has been skipped
Add Kubernetes-optimized Dockerfiles alongside original Docker Compose versions:
**New K8s Dockerfiles:**
- python/Dockerfile.k8s.server - Non-root, graceful shutdown
- python/Dockerfile.k8s.mcp - Lightweight K8s optimized
- python/Dockerfile.k8s.agents - Production-ready agents
- archon-ui-main/Dockerfile.k8s.production - Non-root nginx
**CI/CD Updates:**
- Modified .gitea/workflows/build-images.yml for serial execution
- Builds 8 images: 4 Docker versions + 4 K8s versions
- Tags: docker-latest/docker-{sha} and k8s-latest/k8s-{sha}
- Serial execution prevents memory overload
**K8s Manifest Updates:**
- Updated k8s-manifests-complete.yaml to use k8s-latest tags
- Added securityContext for non-root execution
- Added terminationGracePeriodSeconds for graceful shutdown
- Applied container security best practices
**Optimizations:**
- Non-root users (UID/GID 1001) for all services
- Proper signal propagation (graceful shutdown)
- Removed HEALTHCHECK (K8s uses probes)
- Cache cleanup for smaller images (~10% reduction)
- Production-only builds (no test files)
**Documentation:**
- DOCKER_K8S_BUILD_STRATEGY.md - Complete usage guide
- DOCKERFILE_K8S_IMPROVEMENTS.md - Technical analysis
Original Dockerfiles remain unchanged for Docker Compose compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.4 KiB
Docker
49 lines
1.4 KiB
Docker
# Agents Service - Kubernetes optimized build
|
|
# Lightweight Pydantic AI agents optimized for K8s
|
|
# Optimizations:
|
|
# - Non-root user for security
|
|
# - Proper signal propagation for graceful shutdown
|
|
# - No HEALTHCHECK (K8s uses liveness/readiness probes)
|
|
# - Cache cleanup for smaller image size
|
|
|
|
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install uv
|
|
RUN pip install --no-cache-dir uv && \
|
|
rm -rf ~/.cache/pip
|
|
|
|
# Copy pyproject.toml for dependency installation
|
|
COPY pyproject.toml .
|
|
|
|
# Install only agents dependencies using uv
|
|
RUN uv pip install --system --group agents && \
|
|
rm -rf ~/.cache/uv ~/.cache/pip
|
|
|
|
# Create non-root user
|
|
RUN groupadd -r appuser -g 1001 && \
|
|
useradd -r -g appuser -u 1001 appuser && \
|
|
chown -R appuser:appuser /app
|
|
|
|
# Copy agents code - no dependencies on server code
|
|
# Agents use MCP tools for all operations
|
|
COPY --chown=appuser:appuser src/agents/ src/agents/
|
|
COPY --chown=appuser:appuser src/__init__.py src/
|
|
|
|
# Set environment variables
|
|
ENV PYTHONPATH="/app:$PYTHONPATH"
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Expose Agents port
|
|
ARG ARCHON_AGENTS_PORT=8052
|
|
ENV ARCHON_AGENTS_PORT=${ARCHON_AGENTS_PORT}
|
|
EXPOSE ${ARCHON_AGENTS_PORT}
|
|
|
|
# Switch to non-root user
|
|
USER appuser
|
|
|
|
# Run the Agents service with proper signal propagation for K8s
|
|
# Using exec to ensure SIGTERM reaches the Python process for graceful shutdown
|
|
CMD ["sh", "-c", "exec python -m uvicorn src.agents.server:app --host 0.0.0.0 --port ${ARCHON_AGENTS_PORT}"]
|