FROM mcr.microsoft.com/devcontainers/base@sha256:ce2e9e611939e611b737362c045bb6d3449bb3efb84898525d724aace1737b90

# Install UV package manager
COPY --from=ghcr.io/astral-sh/uv:0.7.21@sha256:a64333b61f96312df88eafce95121b017cbff72033ab2dbc6398edb4f24a75dd /uv /uvx /bin/

# Set up Python virtual environment
ENV VIRTUAL_ENV=/workspaces/.venv
ENV UV_PROJECT_ENVIRONMENT=/workspaces/.venv

# Create necessary directories and set permissions
RUN mkdir -p /workspaces /commandhistory && \
    chown -R vscode:vscode /workspaces /commandhistory

# Set up command history persistence for Claude Code
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" && \
    echo $SNIPPET >> /home/vscode/.bashrc && \
    echo $SNIPPET >> /home/vscode/.zshrc && \
    touch /commandhistory/.bash_history && \
    chown -R vscode:vscode /commandhistory

# Set environment variable to help with container orientation
ENV DEVCONTAINER=true

# Create Claude configuration directory
RUN mkdir -p /home/vscode/.claude && \
    chown -R vscode:vscode /home/vscode/.claude

# Switch to non-root user
USER vscode

# Set working directory
WORKDIR /workspaces
