fix(docker): add launcher image build configuration

- Add picoclaw-launcher Docker image build to .goreleaser.yaml
- Create Dockerfile.launcher for standalone launcher builds
- Create Dockerfile.launcher.goreleaser for GoReleaser builds
- Create entrypoint-launcher.sh for launcher container entrypoint
- Add picoclaw-launcher service to docker-compose.yml with launcher profile

Fixes #1350: launcher docker镜像manifest不可用
This commit is contained in:
曾文锋0668000834 2026-03-12 20:55:26 +08:00
parent 95716b106b
commit 83bd830360
5 changed files with 113 additions and 0 deletions

View file

@ -125,6 +125,23 @@ dockers_v2:
- linux/arm64
- linux/riscv64
- id: picoclaw-launcher
dockerfile: docker/Dockerfile.launcher.goreleaser
extra_files:
- docker/entrypoint-launcher.sh
ids:
- picoclaw-launcher
images:
- "ghcr.io/{{ .Env.GITHUB_REPOSITORY_OWNER }}/picoclaw"
- '{{ if not (isEnvSet "NIGHTLY_BUILD") }}docker.io/{{ .Env.DOCKERHUB_IMAGE_NAME }}{{ end }}'
tags:
- "launcher-{{ .Tag }}"
- '{{ if isEnvSet "NIGHTLY_BUILD" }}launcher-nightly{{ else }}launcher{{ end }}'
platforms:
- linux/amd64
- linux/arm64
- linux/riscv64
notarize:
macos:
- enabled: '{{ isEnvSet "MACOS_SIGN_P12" }}'

View file

@ -0,0 +1,47 @@
# ============================================================
# Stage 1: Build the picoclaw-launcher binary
# ============================================================
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-launcher
# ============================================================
# Stage 2: Minimal runtime image for launcher
# ============================================================
FROM alpine:3.23
RUN apk add --no-cache ca-certificates tzdata curl
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -q --spider http://localhost:8080/health || exit 1
# Copy binary
COPY --from=builder /src/build/picoclaw-launcher /usr/local/bin/picoclaw-launcher
# Create non-root user and group
RUN addgroup -g 1000 picoclaw && \
adduser -D -u 1000 -G picoclaw picoclaw
# Create picoclaw home directory
RUN mkdir -p /home/picoclaw/.picoclaw && \
chown -R picoclaw:picoclaw /home/picoclaw
# Switch to non-root user
USER picoclaw
ENV HOME=/home/picoclaw
EXPOSE 8080
ENTRYPOINT ["picoclaw-launcher"]

View file

@ -0,0 +1,14 @@
FROM alpine:3.21
ARG TARGETPLATFORM
RUN apk add --no-cache ca-certificates tzdata curl
COPY $TARGETPLATFORM/picoclaw-launcher /usr/local/bin/picoclaw-launcher
COPY docker/entrypoint-launcher.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]

View file

@ -32,3 +32,23 @@ services:
# - "host.docker.internal:host-gateway"
volumes:
- ./data:/root/.picoclaw
# ─────────────────────────────────────────────
# PicoClaw Launcher (Web Console)
# docker compose -f docker/docker-compose.yml --profile launcher up picoclaw-launcher
# ─────────────────────────────────────────────
picoclaw-launcher:
image: docker.io/sipeed/picoclaw:launcher
container_name: picoclaw-launcher
restart: on-failure
profiles:
- launcher
ports:
- "8080:8080"
# Uncomment to access host network; leave commented unless needed.
#extra_hosts:
# - "host.docker.internal:host-gateway"
volumes:
- ./data:/home/picoclaw/.picoclaw
environment:
- PICOCLAW_HOME=/home/picoclaw/.picoclaw

View file

@ -0,0 +1,15 @@
#!/bin/sh
set -e
# First-run: neither config nor workspace exists.
# If config.json is already mounted but workspace is missing we skip onboard to
# avoid the interactive "Overwrite? (y/n)" prompt hanging in a non-TTY container.
if [ ! -d "${HOME}/.picoclaw/workspace" ] && [ ! -f "${HOME}/.picoclaw/config.json" ]; then
picoclaw-launcher onboard
echo ""
echo "First-run setup complete."
echo "Edit ${HOME}/.picoclaw/config.json (add your API key, etc.) then restart the container."
exit 0
fi
exec picoclaw-launcher "$@"