# Use a standard Go development image as the base
FROM golang:1.21

# Install common development tools and security updates
RUN apt-get update && apt-get install -y \
    build-essential \
    git \
    curl \
    tree \
    wget \
    && rm -rf /var/lib/apt/lists/*

# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
    && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
    && apt-get update \
    && apt-get install -y gh \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user for the agent to run as
RUN useradd -ms /bin/bash agent

# Set the working directory for the agent
WORKDIR /home/agent/work

# Switch to the non-root user
USER agent

# Keep the container alive
CMD ["sleep", "infinity"]

