Skip to content

feat: add docker-dev image and update-cu-base script for container-use support - #1097

Merged
kalbasit merged 1 commit into
mainfrom
container-use-support
Mar 16, 2026
Merged

kalbasit merged 1 commit into
mainfrom
container-use-support

Conversation

@kalbasit

Copy link
Copy Markdown
Owner

Add a Nix-built Docker image (docker-dev) for use as the container-use
base image, enabling Claude Code agents to run in a fully reproducible
dev environment with all required tools (go, golangci-lint, sqlc,
sqlfluff, dbmate, delve, mariadb, minio, postgres, redis, skopeo, etc.)
and pre-configured integration test environment variables.

Extract shared dev packages into dev-packages.nix to avoid duplication
between the devShell and the docker-dev image. Add the update-cu-base
script that builds the image, pushes it to Docker Hub if not already
present, and updates .container-use/environment.json atomically.

Also add CLAUDE.md documentation for the container-use workflow and
gitignore .container-use/environment.json (auto-generated, local state).

@kalbasit

kalbasit commented Mar 16, 2026 •

Copy link
Copy Markdown
Owner Author

This change is part of the following stack:

Change managed by git-spice.

@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. documentation Improvements or additions to documentation enhancement New feature or request labels Mar 16, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the developer experience by introducing a robust, reproducible container-based development environment. It streamlines the setup and maintenance of development tools and dependencies, ensuring consistency across different environments and facilitating easier onboarding for new contributors. The changes aim to improve the reliability of agent execution and simplify the management of development infrastructure.

Highlights

  • New Docker Development Image: Introduced a new Nix-built Docker image (docker-dev) to serve as the base for container-use environments, providing a fully reproducible development setup.
  • Reproducible Dev Environment: Enabled Claude Code agents to operate within a fully reproducible development environment, pre-configured with essential tools (Go, linters, database clients, etc.) and integration test variables.
  • Shared Development Packages: Refactored development package definitions by extracting common tools into nix/dev-packages.nix to reduce duplication between the devShell and the Docker image.
  • Automated Image Management Script: Provided an update-cu-base script that automates the building, pushing (if not already present on Docker Hub), and configuration of the docker-dev image, updating .container-use/environment.json atomically.
  • Container-Use Documentation: Documented the container-use workflow, including setup and update instructions for the development image, in CLAUDE.md.
  • Git Ignore Configuration: Ensured local container-use environment configurations (.container-use/environment.json) are ignored by Git.
Changelog
  • .gitignore
    • Added .container-use/environment.json to ignore local environment configurations.
  • CLAUDE.md
    • Added a new "Container use" section.
    • Included guidelines for agent interaction within container environments.
    • Provided detailed instructions for setting up and updating the docker-dev image using nix run .#update-cu-base.
  • nix/dev-packages.nix
    • Created a new Nix file to centralize common development packages like go, golangci-lint, sqlc, sqlfluff, delve, mariadb, minio, postgresql, redis, skopeo, pre-commit, and kubernetes-helm.
  • nix/devshells/flake-module.nix
    • Refactored devShells.default.buildInputs to import packages from nix/dev-packages.nix, removing redundant package declarations.
  • nix/packages/docker-dev.nix
    • Added a new Nix file defining the docker-dev layered image, including user setup, working directory, environment variables for integration tests, exposed ports, and OCI labels.
    • Implemented the update-cu-base script, which builds the docker-dev image, checks for its existence on Docker Hub, pushes it if new, and updates .container-use/environment.json with the new image reference.
  • nix/packages/flake-module.nix
    • Imported the new docker-dev.nix module.
Activity
  • No specific activity (comments, reviews) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@dosubot

dosubot Bot commented Mar 16, 2026

Copy link
Copy Markdown

Related Documentation

1 document(s) may need updating based on files changed in this PR:

kalbasit's Space

S3-Compatible Storage Backend
View Suggested Changes
@@ -211,6 +211,20 @@
 
 The script auto-restarts on code changes and configures MinIO for local development. The S3 backend will use the MinIO instance at `localhost:9000` with default credentials (`minioadmin`/`minioadmin`). [Source](https://github.com/kalbasit/ncps/blob/b7653d4303670bb88fd34b8bf82ed3aade09885d/README.md#L46-L782)
 
+#### Container-Use Development Environment
+
+> **Note:** When using the container-use development workflow (e.g., with Claude Code agents), the docker-dev image comes pre-configured with S3 test environment variables.
+
+The `docker-dev` image (set up via `nix run .#update-cu-base`) includes these pre-configured S3 test environment variables:
+
+- `NCPS_TEST_S3_BUCKET=test-bucket`
+- `NCPS_TEST_S3_ENDPOINT=http://host.docker.internal:9000`
+- `NCPS_TEST_S3_REGION=us-east-1`
+- `NCPS_TEST_S3_ACCESS_KEY_ID=test-access-key`
+- `NCPS_TEST_S3_SECRET_ACCESS_KEY=test-secret-key`
+
+When using container-use environments, developers don't need to manually export these variables—they're already configured to work with `nix run .#deps` running on the Docker host. The `host.docker.internal` hostname resolves to the Docker host, allowing the container to access MinIO and other services (PostgreSQL, MariaDB, Redis) running via `nix run .#deps`.
+
 ### Kubernetes Development Environment (Kind)
 You can also develop and test with MinIO running inside a local Kubernetes cluster using [Kind](https://kind.sigs.k8s.io/) and the provided setup script:
 

[Accept] [Decline]

Note: You must be authenticated to accept/decline updates.

How did I do? Any feedback?  Join Discord

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new Nix-built Docker image for development (docker-dev) and a helper script (update-cu-base) to manage it, which is a great addition for creating a reproducible development environment. The changes also include refactoring shared packages to avoid duplication and updating documentation.

My review includes a high-severity security suggestion to remove the --insecure-policy flag from skopeo commands to ensure secure communication with Docker Hub, and a medium-severity suggestion to improve the robustness of the update script by ensuring temporary files are cleaned up.

Comment thread nix/packages/docker-dev.nix Resolved
…e support

Add a Nix-built Docker image (docker-dev) for use as the container-use
base image, enabling Claude Code agents to run in a fully reproducible
dev environment with all required tools (go, golangci-lint, sqlc,
sqlfluff, dbmate, delve, mariadb, minio, postgres, redis, skopeo, etc.)
and pre-configured integration test environment variables.

Extract shared dev packages into dev-packages.nix to avoid duplication
between the devShell and the docker-dev image. Add the update-cu-base
script that builds the image, pushes it to Docker Hub if not already
present, and updates .container-use/environment.json atomically.

Also add CLAUDE.md documentation for the container-use workflow and
gitignore .container-use/environment.json (auto-generated, local state).
@kalbasit
kalbasit force-pushed the container-use-support branch from 2abc3c2 to d3ac1b1 Compare March 16, 2026 23:40
@kalbasit
kalbasit enabled auto-merge (squash) March 16, 2026 23:41
@codecov

codecov Bot commented Mar 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 5.04%. Comparing base (40d20c9) to head (d3ac1b1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1097   +/-   ##
=====================================
  Coverage   5.04%   5.04%           
=====================================
  Files          6       6           
  Lines        436     436           
=====================================
  Hits          22      22           
  Misses       410     410           
  Partials       4       4           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kalbasit
kalbasit merged commit 8abcff8 into main Mar 16, 2026
21 checks passed
@kalbasit
kalbasit deleted the container-use-support branch March 16, 2026 23:53
kalbasit added a commit that referenced this pull request Jun 8, 2026
## Summary

The `[Unreleased]` section was populated in #1309 but skewed toward the
recent CDC-drain, in-flight-staging, and Ent-migration work, omitting
several user-facing features and fixes that also landed since v0.9.4.
This backfills the missing notable changes, each cross-referenced by PR.

**Added**
- `ncps fsck` command + Helm fsck CronJob (#975, #996, #998, #999,
#1000, #1004, #1006, #1176)
- Closure pinning HTTP endpoints `POST`/`DELETE /pin/{hash}.narinfo`,
`GET /pins` (#1108)
- pprof server via `--pprof-addr` (#1063)
- CDC lazy chunking as a feature + `--cache-cdc-lazy-cleanup-schedule` +
recovery cron (#1082, #1083, #1089, #1096)
- Helm: auto `GOMEMLIMIT` (#1061), configurable temp volume /
`volumeClaimTemplate` (#1074, #1077), SQLite `Recreate` strategy (#1012)
- Startup storage reporting + deprecated-narinfo warning (#959, #961)
- `docker-dev` image (#1097)

**Fixed**
- `store/tmp` no longer wiped on startup (#1313)
- `nix-hash` NAR verification (#1101)
- Prometheus counters primed at startup (#1337, #1343)
- 404 on un-reassemblable chunked NARs (#1319), purged narinfo no longer
500 (#1318), fail-fast tmp validation (#1086)
- Further CDC/cache reliability fixes (#1317, #1346, #1341, #1342,
#1331, #1347)

**Changed**
- CDC config now persisted in the DB config table (#971)

Dependency bumps, CI/test-only changes, and the internal Ent-conversion
PRs are intentionally excluded; the existing Ent-migration entry already
covers that work.

## Test plan

- [x] `nix fmt` reports no changes (docs-only edit)
- [x] CHANGELOG section structure intact
(Added/Fixed/Changed/Removed/Migration/CI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant