# Dockerfile.binary
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Install building dependencies
RUN apt-get update && apt-get install -y \
build-essential \
binutils \
patchelf \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /build
COPY agent-node/requirements.txt .
RUN pip install --no-cache-dir pyinstaller -r requirements.txt
# Copy skills manually so we can bundle them dynamically
COPY skills /skills
COPY agent-node .
# PyInstaller bundle the application
# --add-data allows dynamic plugins to map correctly
RUN pyinstaller \
--name cortex-agent \
--onefile \
--clean \
--strip \
--hidden-import google \
--hidden-import grpc \
--hidden-import psutil \
--hidden-import yaml \
--add-data "/skills:skills" \
src/agent_node/main.py
# Export stage
FROM scratch
COPY --from=0 /build/dist/cortex-agent /cortex-agent