# ============================================================ # Stage 1: Build the picoclaw binary # ============================================================ FROM golang:1.26-alpine AS builder RUN apk add --no-cache git make WORKDIR /src # Cache dependencies COPY go.mod go.sum ./ RUN go mod download # Copy source and build COPY . . RUN go mod tidy RUN make build # ============================================================ # Stage 2: Minimal runtime image # ============================================================ FROM alpine:3.23 RUN apk add --no-cache \ ca-certificates \ tzdata \ curl \ git \ github-cli \ jq \ make \ bash \ openssh-client \ sqlite \ docker-cli \ go \ tmux \ python3 \ py3-pip \ ffmpeg \ nodejs \ npm # Install Python dependencies RUN pip3 install --break-system-packages gTTS # Install Node.js dependencies (summarize CLI) RUN npm install -g @steipete/summarize # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget -q --spider http://localhost:7860/health || exit 1 # Expose port for Hugging Face Spaces EXPOSE 7860 # Copy binary COPY --from=builder /src/build/picoclaw /usr/local/bin/picoclaw # Copy workspace template for fallback COPY --from=builder /src/workspace /app/workspace # Copy builtin skills for manual installation if needed COPY workspace/skills /picoclaw/skills # Create picoclaw home directory RUN /usr/local/bin/picoclaw onboard # Fix DNS resolution RUN echo "nameserver 8.8.8.8" > /etc/resolv.conf || true # Copy custom config COPY config/config.json /root/.picoclaw/config.json # Copy entrypoint and helper scripts COPY entrypoint.sh /entrypoint.sh COPY scripts/sync_dataset.sh /usr/local/bin/sync_dataset.sh RUN chmod +x /entrypoint.sh /usr/local/bin/sync_dataset.sh ENTRYPOINT ["/entrypoint.sh"] CMD ["picoclaw", "gateway"]