FROM debian:bookworm-slim # Prevent prompts ENV DEBIAN_FRONTEND=noninteractive # Install core dependencies RUN apt-get update && apt-get install -y \ curl \ wget \ git \ python3 \ python3-pip \ sudo \ lsb-release \ net-tools \ &> /dev/null # Install code-server (The Agent's Interface) RUN curl -fsSL https://code-server.dev/install.sh | sh # Install Cloudflared (The Tunnel) RUN curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && \ dpkg -i cloudflared.deb && \ rm cloudflared.deb # Create a non-root user 'puppet' for HF compliance RUN useradd -m -s /bin/bash puppet && \ echo "puppet ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER puppet WORKDIR /home/puppet # Prepare Agent workspace RUN mkdir -p /home/puppet/agent_workspace # Copy the orchestration script COPY --chown=puppet:puppet entrypoint.sh /home/puppet/entrypoint.sh RUN chmod +x /home/puppet/entrypoint.sh # HF Spaces default port is 7860 EXPOSE 7860 ENTRYPOINT ["/home/puppet/entrypoint.sh"]