From df87f3ba56c90046fcb0ea8ba9f6ceb3d2f34f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=BE=E6=96=87=E9=94=8B0668000834?= Date: Wed, 11 Mar 2026 09:27:45 +0800 Subject: [PATCH] Add development Dockerfile with extra tools (jq, git, python3, pip, bash) This addresses PR #1304 concerns by: - Keeping the main Dockerfile minimal for production use - Creating a separate Dockerfile.dev for development/debugging scenarios - Adding docker-compose service with 'dev' profile for optional use The development image includes tools for scripting, JSON processing, and debugging while maintaining the minimal image for resource-constrained deployments. --- docker/Dockerfile.dev | 53 +++++++++++++++++++++++++++++++++++++++ docker/docker-compose.yml | 19 ++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 docker/Dockerfile.dev diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev new file mode 100644 index 000000000..025afcb18 --- /dev/null +++ b/docker/Dockerfile.dev @@ -0,0 +1,53 @@ +# ============================================================ +# Development Dockerfile for PicoClaw +# Includes additional tools (jq, git, python3, pip, bash) +# for debugging, scripting, and development scenarios +# ============================================================ +FROM golang:1.25-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 make build + +# ============================================================ +# Development runtime image with additional tools +# ============================================================ +FROM alpine:3.23 + +RUN apk add --no-cache \ + ca-certificates \ + tzdata \ + curl \ + jq \ + git \ + python3 \ + py3-pip \ + bash + +# Health check +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget -q --spider http://localhost:18790/health || exit 1 + +# Copy binary +COPY --from=builder /src/build/picoclaw /usr/local/bin/picoclaw + +# Create non-root user and group +RUN addgroup -g 1000 picoclaw && \ + adduser -D -u 1000 -G picoclaw picoclaw + +# Switch to non-root user +USER picoclaw + +# Run onboard to create initial directories and config +RUN /usr/local/bin/picoclaw onboard + +ENTRYPOINT ["picoclaw"] +CMD ["gateway"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index b26cf4199..3db50705c 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -50,3 +50,22 @@ services: - "127.0.0.1:18790:18790" volumes: - ./data:/root/.picoclaw + + # ───────────────────────────────────────────── + # PicoClaw Gateway (Development build with extra tools) + # Includes: jq, git, python3, pip, bash + # docker compose -f docker/docker-compose.yml --profile dev up picoclaw-gateway-dev + # ───────────────────────────────────────────── + picoclaw-gateway-dev: + build: + context: .. + dockerfile: docker/Dockerfile.dev + container_name: picoclaw-gateway-dev + restart: on-failure + profiles: + - dev + # Uncomment to access host network; leave commented unless needed. + #extra_hosts: + # - "host.docker.internal:host-gateway" + volumes: + - ./data:/root/.picoclaw