# syntax=docker/dockerfile:1
# Generated by mcp-wizard-generators (deployment: agentcore-container). DEPLOY.md.

# --- build: install the hash-locked dependencies into a virtualenv ---------------
# linux/arm64 is the only architecture this target runs: pinned on purpose.
# hadolint ignore=DL3029
FROM --platform=linux/arm64 python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90 AS build
ENV PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR /build
COPY requirements-aws.lock ./
RUN python -m venv /opt/venv \
 && /opt/venv/bin/pip install --require-hashes -r requirements-aws.lock

# --- runtime: the virtualenv and the server source, as a non-root user -----------
# linux/arm64 is the only architecture this target runs: pinned on purpose.
# hadolint ignore=DL3029
FROM --platform=linux/arm64 python:3.13-slim@sha256:e48f59cdba69a3cbd9ed2cf0f348d90d45a8d350d98134cf1070bc106ee9ed90
COPY --from=build /opt/venv /opt/venv
COPY src/ /app/src/
COPY generation-manifest.json /app/
WORKDIR /app
ENV PATH=/opt/venv/bin:$PATH \
    PYTHONPATH=/app/src \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    MCP_TRANSPORT=streamable-http \
    MCP_HOST=0.0.0.0 \
    MCP_PORT=8000 \
    MCP_PATH=/mcp
# MCP_AUTH is set where the container runs (deploy/terraform/main.tf). Without it the
# server refuses to listen on 0.0.0.0, so the image never runs unprotected by accident.
USER 10001
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
  CMD ["python", "-c", "import socket; socket.create_connection(('127.0.0.1', 8000), 3).close()"]
CMD ["python", "-m", "pets_tiny_mcp"]
