37 lines
1.2 KiB
Docker
37 lines
1.2 KiB
Docker
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
FROM ghcr.io/astral-sh/uv:python3.13-bookworm-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Configure UV for container environment
|
|
ENV UV_SYSTEM_PYTHON=1 \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
DOCKER_CONTAINER=1 \
|
|
OTEL_PYTHON_LOG_CORRELATION=true \
|
|
PYTHONUNBUFFERED=1
|
|
|
|
# Copy and install agent-specific requirements first
|
|
COPY agents/strands-single-agent/requirements.txt requirements.txt
|
|
RUN uv pip install --no-cache -r requirements.txt && \
|
|
uv pip install --no-cache aws-opentelemetry-distro==0.16.0
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 bedrock_agentcore
|
|
USER bedrock_agentcore
|
|
|
|
EXPOSE 8080
|
|
|
|
# Copy agent code and shared utilities
|
|
COPY agents/strands-single-agent/strands_agent.py .
|
|
COPY agents/strands-single-agent/tools/ tools/
|
|
COPY agents/utils/ utils/
|
|
|
|
# Healthcheck using Python (no extra dependencies needed)
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/ping', timeout=2)" || exit 1
|
|
|
|
# Start agent with OpenTelemetry instrumentation
|
|
CMD ["opentelemetry-instrument", "python", "-m", "strands_agent"]
|