Skip to content

feat: add new compose file for local build and selinux enabled#1846

Open
3mp3ri0r wants to merge 13 commits intosipeed:mainfrom
3mp3ri0r:feat/add-new-compose-file-for-local-build-and-selinux-enabled
Open

feat: add new compose file for local build and selinux enabled#1846
3mp3ri0r wants to merge 13 commits intosipeed:mainfrom
3mp3ri0r:feat/add-new-compose-file-for-local-build-and-selinux-enabled

Conversation

@3mp3ri0r
Copy link
Contributor

@3mp3ri0r 3mp3ri0r commented Mar 20, 2026

📝 Description

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

Closes #1833

📚 Technical Context (Skip for Docs)

  • Reference URL:
  • Reasoning:

🧪 Test Environment

  • Hardware:
  • OS:
  • Model/Provider:
  • Channels:

📸 Evidence (Optional)

Run Gateway

Command:

podman compose -f docker/docker-compose.local.yml --profile gateway up

Result:

image
Run Agent

Command:

podman compose -f docker/docker-compose.local.yml --profile agent run --rm picoclaw-agent -m "What is 2+2?"

Result:

image

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

@3mp3ri0r 3mp3ri0r changed the title Feat/add new compose file for local build and selinux enabled feat: add new compose file for local build and selinux enabled Mar 20, 2026
@sipeed-bot sipeed-bot bot added type: enhancement New feature or request domain: docker labels Mar 20, 2026
@3mp3ri0r 3mp3ri0r marked this pull request as ready for review March 21, 2026 05:48
Copilot AI review requested due to automatic review settings March 21, 2026 05:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new local-development Compose file intended to build PicoClaw from the repo’s docker/Dockerfile and run it in a way that works on SELinux-enabled hosts.

Changes:

  • Introduces docker/docker-compose.local.yml with picoclaw-agent and picoclaw-gateway services built from local sources.
  • Configures user namespace mode and bind-mounts a local data directory into the non-root user’s home.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3 to +5
# PicoClaw Agent (one-shot query)
# docker compose -f docker/docker-compose.yml run --rm picoclaw-agent -m "Hello"
# ─────────────────────────────────────────────
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage examples in these header comments reference docker/docker-compose.yml, but this file is docker/docker-compose.local.yml. This is likely to mislead users (and the PR description uses podman compose -f docker/docker-compose.local.yml ...). Update the examples to point at the correct compose file (and, if intended, the correct CLI).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines +10 to +13
userns_mode: "keep-id"
container_name: picoclaw-agent
security_opt:
- label=disable
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

userns_mode: "keep-id" is not supported by Docker Compose (it's a Podman-specific value). Since the comment examples currently say docker compose ..., this compose file will fail for Docker users. Either document that this file is intended for Podman only (and adjust the examples accordingly), or switch to a Docker-compatible approach (e.g., avoid keep-id and use a portable user: setting).

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried on my macbook using docker and actually it works using the same dockerfile.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated by add user: "${UID:-1000}:${GID:-1000}" this way works on both docker and podman. Here's the proof.

Docker

Screenshot 2026-03-21 at 18 36 50

Podman

Screenshot 2026-03-21 at 18 39 30

Comment on lines +34 to +36
security_opt:
- label=disable
container_name: picoclaw-gateway
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a compose file meant to be SELinux-compatible and safe, security_opt: - label=disable is a security regression: it disables SELinux separation for the container. If the intent is to run under SELinux, prefer relying on the :Z volume relabeling (or an explicit SELinux label type) rather than disabling labeling entirely.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have argument for this. Each company have policy related to security. It's better for them to set by themself on how the seccom policy looks like. This is more on how to make it works for testing / development purpose.

Comment on lines +12 to +13
security_opt:
- label=disable
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security_opt: - label=disable disables SELinux labeling for the container, which undermines the stated goal of being SELinux-compatible while remaining safe. Consider removing this and relying on the bind mount :Z relabeling (or using an explicit label type) so SELinux confinement remains enabled.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have argument for this. Each company have policy related to security. It's better for them to set by themself on how the seccom policy looks like. This is more on how to make it works for testing / development purpose.

Copilot AI review requested due to automatic review settings March 21, 2026 11:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +21 to +23
volumes:
- ./data:/home/picoclaw/.picoclaw:Z
entrypoint: ["picoclaw", "agent"]
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both services bind-mount the same host directory (./data). Using the SELinux private relabel flag :Z can prevent sharing the mount between multiple containers and can cause access issues if picoclaw-agent and picoclaw-gateway are ever run at the same time. If concurrent use is expected, switch to the shared label :z (or document that only one service should run with this mount at a time).

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +48
volumes:
- ./data:/home/picoclaw/.picoclaw:Z
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same SELinux mount-labeling concern here: because both services mount ./data, using :Z (private label) can make the directory unusable when another container mounts it. Prefer :z for a directory intended to be shared between multiple containers, or document that only one of these profiles should be used at a time.

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +22
userns_mode: "keep-id"
user: "${UID:-1000}:${GID:-1000}"
container_name: picoclaw-agent
security_opt:
- label=disable
profiles:
- agent
# Uncomment to access host network; leave commented unless needed.
#extra_hosts:
# - "host.docker.internal:host-gateway"
volumes:
- ./data:/home/picoclaw/.picoclaw:Z
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The service forces user: ${UID}:${GID} but the image only defines the picoclaw user (uid 1000). If a host sets UID/GID to values not present in /etc/passwd (common on macOS like 501), Go’s os.UserHomeDir() can fail and PicoClaw may fall back to a relative ./.picoclaw instead of the mounted /home/picoclaw/.picoclaw, breaking persistence. Consider setting PICOCLAW_HOME=/home/picoclaw/.picoclaw (or at least HOME=/home/picoclaw) in environment: when overriding user, or avoid overriding user unless the uid exists in the image.

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +48
userns_mode: "keep-id"
user: "${UID:-1000}:${GID:-1000}"
security_opt:
- label=disable
container_name: picoclaw-gateway
restart: unless-stopped
profiles:
- gateway
# Uncomment to access host network; leave commented unless needed.
#extra_hosts:
# - "host.docker.internal:host-gateway"
volumes:
- ./data:/home/picoclaw/.picoclaw:Z
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as the agent service: overriding user to an arbitrary host UID/GID can cause PicoClaw’s home directory resolution to fail (uid not in /etc/passwd), so it may not read/write the mounted /home/picoclaw/.picoclaw. Add PICOCLAW_HOME=/home/picoclaw/.picoclaw (or HOME=/home/picoclaw) via environment: to make persistence deterministic.

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +16
security_opt:
- label=disable
profiles:
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security_opt: label=disable disables SELinux labeling for the container, which undermines the stated goal of being SELinux-compatible and safe. It’s also redundant/confusing alongside the :Z volume relabel option. Prefer removing label=disable and relying on :Z (or document clearly when/why SELinux labeling must be disabled).

Copilot uses AI. Check for mistakes.
Comment on lines +38 to +40
security_opt:
- label=disable
container_name: picoclaw-gateway
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same SELinux concern here: label=disable turns off SELinux confinement for the container and is redundant with the :Z relabel on the bind mount. To keep the setup “safe” on SELinux hosts, prefer leaving labeling enabled and using the :Z mount option (or document the tradeoff if disabling is required).

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +10
build:
context: ..
dockerfile: docker/Dockerfile
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The build: stanza is duplicated between picoclaw-agent and picoclaw-gateway. To reduce the chance of them drifting (e.g., different Dockerfile/context in future edits), consider using a YAML anchor/extension field for the shared build configuration.

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 23, 2026 10:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +25 to +26
# Uncomment to make healtcheck works on podman pod model
# - PICOCLAW_GATEWAY_HOST=0.0.0.0
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "healtcheck" should be "healthcheck" (and consider rephrasing the sentence to be grammatically correct, e.g., "make healthcheck work...").

Copilot uses AI. Check for mistakes.
Comment on lines +57 to +58
# Uncomment to make healtcheck works on podman pod model
# - PICOCLAW_GATEWAY_HOST=0.0.0.0
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: "healtcheck" should be "healthcheck" (and consider rephrasing the sentence to be grammatically correct, e.g., "make healthcheck work...").

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +15
# default: turns off SELinux for easier to run and test
# change or remove label=disable on production and employ seccomp policy instead
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar in comment: "on production" should be "in production" (this comment is duplicated for both services, so update both to keep the guidance consistent).

Copilot uses AI. Check for mistakes.
Comment on lines +44 to +45
# default: turns off SELinux for easier to run and test
# change or remove label=disable on production and employ seccomp policy instead
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar in comment: "on production" should be "in production" (this comment is duplicated for both services, so update both to keep the guidance consistent).

Copilot uses AI. Check for mistakes.
Copilot AI review requested due to automatic review settings March 23, 2026 10:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@3mp3ri0r
Copy link
Contributor Author

Can you help to check or suggest the right person, @lxowalle? Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Expect to be able to run latest commit via container safely and compatible with SELinux enabled environment

2 participants