Files
gcp_solution_architecture_a…/Dockerfile
Jonathan Boniface 7ee49ab352
Some checks failed
validation / verify (push) Failing after 10s
latest refactoring
2026-10-06 20:22:37 +01:00

66 lines
2.4 KiB
Docker

FROM python:3.12-slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency specifications and install wheels
COPY requirements.txt ./
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
# Terraform CLI for fmt/validate/plan tools (never apply), verified against HashiCorp's checksums
ARG TERRAFORM_VERSION=1.14.3
RUN apt-get update && apt-get install -y --no-install-recommends unzip \
&& rm -rf /var/lib/apt/lists/* \
&& curl -fsSLO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip" \
&& curl -fsSLO "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS" \
&& grep "linux_amd64.zip" "terraform_${TERRAFORM_VERSION}_SHA256SUMS" | sha256sum -c - \
&& unzip "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" -d /usr/local/bin \
&& rm "terraform_${TERRAFORM_VERSION}_linux_amd64.zip" "terraform_${TERRAFORM_VERSION}_SHA256SUMS"
# Final production image stage
FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/app \
A2A_HOST=0.0.0.0 \
A2A_PORT=8080
WORKDIR /app
# Create non-root application user for container security
RUN groupadd -g 10001 appgroup && \
useradd -u 10001 -g appgroup -s /bin/sh -m appuser
# Copy installed dependencies from builder
COPY --from=builder /install /usr/local
COPY --from=builder /usr/local/bin/terraform /usr/local/bin/terraform
# Copy the engine, role files, provider bundles and Skills.
COPY app/ ./app/
COPY agents/ ./agents/
COPY providers/ ./providers/
COPY skills/ ./skills/
COPY workflow.yaml ./
# Executions write their outputs under deliverables/executions/<execution_id>/.
RUN mkdir -p deliverables && chown -R appuser:appgroup /app
USER appuser
# The A2A server: JSON-RPC at /a2a, the agent card, /health and pre-approved /generate.
# Set A2A_PUBLIC_URL to the address callers reach, so the agent card advertises it.
EXPOSE 8080
# /health answers once the provider bundle and remote MCP catalogs have loaded.
HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \
CMD python -c "import os, urllib.request; urllib.request.urlopen(f'http://localhost:{os.environ[\"A2A_PORT\"]}/health')" || exit 1
CMD ["python", "-m", "app.main"]