FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive # System packages: code-server + Python + tools RUN apt-get update && apt-get install -y \ python3 python3-pip \ git curl wget jq tmux \ nodejs npm \ httpie \ && rm -rf /var/lib/apt/lists/* # Install code-server RUN curl -fsSL https://code-server.dev/install.sh | sh # Python packages — Flask for KB server only (picoclaw is a Go binary) RUN pip3 install --no-cache-dir \ httpx \ flask \ gunicorn # Workspace WORKDIR /app # Create directory structure RUN mkdir -p /app/kb /app/hooks /app/.picoclaw/workspace/sessions \ /app/.picoclaw/workspace/cron /app/hook_logs # Copy picoclaw Go binary (v0.2.9, statically linked) COPY picoclaw /usr/local/bin/picoclaw RUN chmod +x /usr/local/bin/picoclaw # Copy SOCKS5 bridge (Python, replaces chisel — uses HTTP CONNECT to tinyproxy CF tunnel) COPY socks5_bridge.py /app/socks5_bridge.py # Copy KB files (served by built-in HTTP server on port 8811) COPY kb/ /app/kb/ # Copy hook scripts COPY hooks/ /app/hooks/ RUN chmod +x /app/hooks/*.py # KB HTTP server (Flask on port 8811) COPY kb_server.py /app/kb_server.py # Picoclaw config generator COPY gen_config.py /app/gen_config.py # Startup script — runs chisel + KB server + picoclaw gateway + code-server COPY start.sh /app/start.sh RUN chmod +x /app/start.sh # Expose: 7860 (code-server), 8811 (KB server), 18790 (picoclaw gateway) EXPOSE 7860 8811 # Health check — KB server HEALTHCHECK --interval=120s --timeout=10s --retries=3 \ CMD curl -f http://localhost:8811/health || exit 1 CMD ["/app/start.sh"]