Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions contributing/samples/rlm/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Virtual environment
.venv/
venv/
env/

# Git
.git/
.gitignore

# Python cache
__pycache__/
*.py[cod]
*$py.class
*.so
.Python

# Build artifacts
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.nox/

# IDE
.idea/
.vscode/
*.swp
*.swo

# Local files
*.db
*.sqlite
logs/
*.log
*.jsonl

# Documentation
docs/
*.md
!README.md
!adk_rlm/**/*.md

# Tests
tests/

# Examples
examples/

# Deployment scripts (not needed in container)
deployment/
28 changes: 28 additions & 0 deletions contributing/samples/rlm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Python-generated files
__pycache__/
*.py[oc]
build/
dist/
wheels/
*.egg-info

# Virtual environments
.venv

# Environment files
.env
.env.*

# ADK generated files
.adk/
*/.adk/

original_rlm/
plans/
CLAUDE.md
logs/
.pytest_cache/
sessions.db
corpora/
*.db
.ruff_cache/
1 change: 1 addition & 0 deletions contributing/samples/rlm/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
28 changes: 28 additions & 0 deletions contributing/samples/rlm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:3.12-slim

WORKDIR /app

# Install uv for faster package management (rarely changes)
RUN pip install uv

# Copy only dependency specification first for better caching
COPY pyproject.toml README.md ./

# Create minimal package structure for dependency resolution
RUN mkdir -p adk_rlm && echo '__version__ = "0.1.0"' > adk_rlm/__init__.py

# Install dependencies (this layer is cached unless pyproject.toml changes)
RUN uv pip install --system -e ".[all]" --index-url https://pypi.org/simple/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using --system with uv pip install inside a Dockerfile is generally not recommended. In a Docker image, the environment is already isolated, so installing into the system Python (even a slim one) bypasses uv's virtual environment management. It's often better to let uv manage a virtual environment within the container or use pip install directly if uv's virtual environment features aren't strictly needed in the final image layer.


# Now copy the actual source code (changes frequently)
COPY adk_rlm/ adk_rlm/

# Create logs directory
RUN mkdir -p /app/logs

# Expose port (Cloud Run uses PORT env var)
ENV PORT=8080
EXPOSE 8080

# Run the web server
CMD ["sh", "-c", "python -m adk_rlm.web --host 0.0.0.0 --port $PORT"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

It's generally better to use the exec form of CMD in Dockerfiles (e.g., CMD ["python", "-m", "adk_rlm.web", "--host", "0.0.0.0", "--port", "$PORT"]). The sh -c form runs the command as a child process of sh, which can lead to issues with signal handling (e.g., SIGTERM not being passed to the Python process) and process IDs. Using the exec form ensures that signals are correctly propagated to your application.

Loading