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.
This commit is contained in:
曾文锋0668000834 2026-03-11 09:27:45 +08:00
parent 3dbf197e9f
commit df87f3ba56
2 changed files with 72 additions and 0 deletions

53
docker/Dockerfile.dev Normal file
View file

@ -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"]

View file

@ -50,3 +50,22 @@ services:
- "127.0.0.1:18790:18790" - "127.0.0.1:18790:18790"
volumes: volumes:
- ./data:/root/.picoclaw - ./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