From d99dc3d0c63ad9d34f50cc1ba5e2514b743fef46 Mon Sep 17 00:00:00 2001 From: Matteo Pietro Dazzi Date: Sun, 22 Feb 2026 18:34:55 +0100 Subject: [PATCH] feat: init script --- Dockerfile | 5 ++++- Dockerfile.goreleaser | 3 ++- container/entrypoint | 3 +++ container/init | 3 +++ docker-compose.yml | 12 ++++++++++++ 5 files changed, 24 insertions(+), 2 deletions(-) create mode 100755 container/entrypoint create mode 100755 container/init diff --git a/Dockerfile b/Dockerfile index 0360cfda6..fdf8d6c99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,9 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ # Copy binary COPY --from=builder /src/build/picoclaw /usr/local/bin/picoclaw +# Copy container init scripts +COPY container/* /usr/local/bin/ + # Create non-root user and group RUN addgroup -g 1000 picoclaw && \ adduser -D -u 1000 -G picoclaw picoclaw @@ -39,5 +42,5 @@ USER picoclaw # Run onboard to create initial directories and config RUN /usr/local/bin/picoclaw onboard -ENTRYPOINT ["picoclaw"] +ENTRYPOINT ["entrypoint"] CMD ["gateway"] diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index 0cdc8c6bd..052513e1a 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -5,6 +5,7 @@ ARG TARGETPLATFORM RUN apk add --no-cache ca-certificates tzdata COPY $TARGETPLATFORM/picoclaw /usr/local/bin/picoclaw +COPY container/* /usr/local/bin/ -ENTRYPOINT ["picoclaw"] +ENTRYPOINT ["entrypoint"] CMD ["gateway"] diff --git a/container/entrypoint b/container/entrypoint new file mode 100755 index 000000000..5d5a21c97 --- /dev/null +++ b/container/entrypoint @@ -0,0 +1,3 @@ +#!/bin/sh + +init && picoclaw "$@" diff --git a/container/init b/container/init new file mode 100755 index 000000000..cfb1c507a --- /dev/null +++ b/container/init @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "No init file configured, skipping..." diff --git a/docker-compose.yml b/docker-compose.yml index c268b01cd..906f3e65f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,7 @@ +configs: + init_script: + file: /path/to/your/init/script + services: # ───────────────────────────────────────────── # PicoClaw Agent (one-shot query) @@ -16,6 +20,10 @@ services: volumes: - ./config/config.json:/home/picoclaw/.picoclaw/config.json:ro - picoclaw-workspace:/home/picoclaw/.picoclaw/workspace + configs: + - source: init_script + target: /usr/local/bin/init + mode: 0777 entrypoint: ["picoclaw", "agent"] stdin_open: true tty: true @@ -40,6 +48,10 @@ services: - ./config/config.json:/home/picoclaw/.picoclaw/config.json:ro # Persistent workspace (sessions, memory, logs) - picoclaw-workspace:/home/picoclaw/.picoclaw/workspace + configs: + - source: init_script + target: /usr/local/bin/init + mode: 0777 command: ["gateway"] volumes: