Skip to content

build: pin base images and improve Docker setup#467

Open
pixel365 wants to merge 3 commits intosipeed:mainfrom
pixel365:dockerfile
Open

build: pin base images and improve Docker setup#467
pixel365 wants to merge 3 commits intosipeed:mainfrom
pixel365:dockerfile

Conversation

@pixel365
Copy link
Contributor

📝 Description

Improve Docker image reproducibility and reduce runtime size.

  • Pin golang and alpine base images by sha256 to ensure deterministic builds.
  • Remove explicit wget installation (use BusyBox-provided wget).
  • Reduce final image size.
  • Add optional PICOCLAW_CONFIG_FILE variable for docker-compose to allow flexible config mounting.
  • Minor Dockerfile cleanup and simplification.

No application logic changes.

🗣️ 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

N/A

📚 Technical Context (Skip for Docs)

  • Reasoning: Improve build reproducibility, reduce image size, and simplify Docker configuration without changing runtime behavior.

🧪 Test Environment

  • Hardware: PC
  • OS: Fedora

📸 Evidence (Optional)

Click to view Logs/Screenshots
  • Image size reduced from ~48 MB to ~39 MB
  • Healthcheck verified using BusyBox wget
  • docker-compose config override tested with PICOCLAW_CONFIG_FILE

☑️ 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.

- Pin golang and alpine images by sha256 for reproducible builds
- Remove unnecessary wget package (use BusyBox wget)
- Reduce runtime image size
- Improve docker-compose config handling via PICOCLAW_CONFIG_FILE
- Minor Dockerfile cleanup
Copy link

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

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

Solid Docker hardening. Image pinning with SHA256 digests is great for reproducible builds and supply chain security. Moving user creation to the builder stage and copying passwd/group is a clean pattern that avoids installing shadow in the runtime image. Removing curl in favor of BusyBox wget reduces attack surface.

The PICOCLAW_CONFIG_FILE env var in docker-compose is a nice UX touch. LGTM.

Copy link

@nikolasdehor nikolasdehor left a comment

Choose a reason for hiding this comment

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

Solid improvement to the Docker setup. The sha256 pinning, non-root user, and image size reduction are all good practices.

A few observations:

  1. /etc/passwd overwriteCOPY --from=builder /etc/passwd_picoclaw /etc/passwd replaces the entire /etc/passwd in the runtime image, removing root, nobody, and other system users. This can break processes that need to resolve UIDs (e.g., crond, syslogd, or anything su/setuid). A safer approach is to COPY --from=builder the passwd/group files under a different name and then cat >> /etc/passwd to append, or just run the adduser in Stage 2 directly (it's a single layer either way).

  2. vendor/ in .gitignore — This is fine if the project doesn't vendor dependencies, but worth noting in the PR description since it's a separate concern from Docker changes.

  3. The PICOCLAW_CONFIG_FILE env var in docker-compose is a nice touch for flexibility.

Minor point on (1) aside, LGTM. The overall direction is correct and the size reduction from ~48MB to ~39MB is meaningful.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants