thehardwarestore.ai

where AI agents shop for the right tools

$ show coder/envbuilder

[account ↗] [repo ↗] APPLICATION ★ 301 64 ● maintained (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

envbuilder is a CLI tool written in Go that builds and runs Dev Containers (as defined by devcontainer.json) inside Docker containers, using a forked version of Kaniko for image building. In production, it clones a Git repository, locates a devcontainer.json or Dockerfile, compiles a Dockerfile with requested features, builds the image via Kaniko (with layer caching), and then executes lifecycle scripts (onCreate, postCreate, etc.) before running an init command as a specified user. It is designed to integrate with Coder workspaces for log forwarding but can operate standalone. The architecture is a single binary with modular components: options parsing (options/), Git operations (git/), devcontainer spec handling (devcontainer/), Kaniko build orchestration (envbuilder.go), and logging (log/). It relies on system calls for user switching (setuid), execution (exec), and filesystem mounts. External dependencies include Git, Docker daemon, and the Kaniko fork. The tool supports extensive configuration via CLI flags and environment variables, with legacy variable support. Key entry points are cmd/envbuilder/main.go (CLI) and envbuilder.go (Run function). The primary data flow is: input options -> clone repo -> parse devcontainer -> compile Dockerfile -> Kaniko build -> execute lifecycle scripts -> setuid -> exec init. The tool also includes a cache probe mode for checking layer availability without full build.

RATING7.5/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTmedium
CONTRIBUTORS29
VELOCITY0.54
OPEN ISSUES84
CLOSED ISSUES105
LAST COMMIT1 month ago
cdr.dev/slog (go) v1.6.2-0.20250703074222-9df5e0a6c145
github.com/GoogleContainerTools/kaniko (go) v1.9.2
github.com/breml/rootcerts (go) v0.2.10
github.com/coder/coder/v2 (go) v2.26.5
github.com/coder/retry (go) v1.5.1
github.com/coder/serpent (go) v0.10.0
github.com/containerd/platforms (go) v1.0.0-rc.1
github.com/distribution/distribution/v3 (go) v3.0.0-alpha.1
github.com/docker/cli (go) v28.3.2+incompatible
github.com/docker/docker (go) v28.3.3+incompatible
github.com/fatih/color (go) v1.18.0
github.com/gliderlabs/ssh (go) v0.3.8
github.com/go-git/go-billy/v5 (go) v5.6.2
github.com/go-git/go-git/v5 (go) v5.16.5
github.com/google/go-cmp (go) v0.7.0
github.com/google/go-containerregistry (go) v0.20.6
github.com/google/uuid (go) v1.6.0
github.com/hashicorp/go-multierror (go) v1.1.1
github.com/kballard/go-shellquote (go) v0.0.0-20180428030007-95032a82bc51
github.com/mattn/go-isatty (go) v0.0.20
github.com/moby/buildkit (go) v0.16.0
github.com/otiai10/copy (go) v1.14.0
github.com/prometheus/procfs (go) v0.16.1
github.com/sirupsen/logrus (go) v1.9.3
github.com/skeema/knownhosts (go) v1.3.1
github.com/stretchr/testify (go) v1.11.1
github.com/tailscale/hujson (go) v0.0.0-20221223112325-20486734a56a
go.uber.org/mock (go) v0.6.0
golang.org/x/crypto (go) v0.45.0
golang.org/x/mod (go) v0.29.0
golang.org/x/sync (go) v0.18.0
golang.org/x/xerrors (go) v0.0.0-20240903120638-7835f813f4da
github.com/creack/pty (go) v1.1.24
github.com/moby/moby (go) v28.3.0+incompatible
github.com/tailscale/peercred (go) v0.0.0-20250107143737-35a0c7bd7edc
cloud.google.com/go/compute/metadata (go) v0.8.0
dario.cat/mergo (go) v1.0.1
filippo.io/edwards25519 (go) v1.1.1
github.com/Azure/azure-sdk-for-go (go) v68.0.0+incompatible
github.com/Azure/go-ansiterm (go) v0.0.0-20250102033503-faa5f7b0171c
github.com/Azure/go-autorest (go) v14.2.0+incompatible
github.com/Azure/go-autorest/autorest (go) v0.11.29
github.com/Azure/go-autorest/autorest/adal (go) v0.9.23
github.com/Azure/go-autorest/autorest/azure/auth (go) v0.5.12
github.com/Azure/go-autorest/autorest/azure/cli (go) v0.4.6
github.com/Azure/go-autorest/autorest/date (go) v0.3.0
github.com/Azure/go-autorest/logger (go) v0.2.1
github.com/Azure/go-autorest/tracing (go) v0.6.0
github.com/DataDog/appsec-internal-go (go) v1.11.2
github.com/DataDog/datadog-agent/comp/core/tagger/origindetection (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/obfuscate (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/proto (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/remoteconfig/state (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/trace (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/util/log (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/util/scrubber (go) v0.64.2
github.com/DataDog/datadog-agent/pkg/version (go) v0.64.2
github.com/DataDog/datadog-go/v5 (go) v5.6.0
github.com/DataDog/dd-trace-go/v2 (go) v2.0.0
github.com/DataDog/go-libddwaf/v3 (go) v3.5.4
github.com/DataDog/go-runtime-metrics-internal (go) v0.0.4-0.20250319104955-81009b9bad14
github.com/DataDog/go-sqllexer (go) v0.1.3
github.com/DataDog/go-tuf (go) v1.1.0-0.5.2
github.com/DataDog/gostackparse (go) v0.7.0
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes (go) v0.26.0
github.com/DataDog/sketches-go (go) v1.4.7
github.com/Masterminds/semver/v3 (go) v3.3.1
github.com/Microsoft/go-winio (go) v0.6.2
github.com/Microsoft/hcsshim (go) v0.13.0
github.com/ProtonMail/go-crypto (go) v1.3.0
github.com/acarl005/stripansi (go) v0.0.0-20180116102854-5a71ef0e047d
github.com/agext/levenshtein (go) v1.2.3
github.com/agnivade/levenshtein (go) v1.2.1
github.com/akutz/memconn (go) v0.1.0
github.com/alexbrainman/sspi (go) v0.0.0-20210105120005-909beea2cc74
github.com/ammario/tlru (go) v0.4.0
github.com/anmitsu/go-shlex (go) v0.0.0-20200514113438-38f4b401e2be
github.com/apparentlymart/go-textseg/v15 (go) v15.0.0
github.com/armon/go-radix (go) v1.0.1-0.20221118154546-54df44f2176c
github.com/aws/aws-sdk-go-v2 (go) v1.38.1
github.com/aws/aws-sdk-go-v2/config (go) v1.30.2
github.com/aws/aws-sdk-go-v2/credentials (go) v1.18.2
github.com/aws/aws-sdk-go-v2/feature/ec2/imds (go) v1.18.1
github.com/aws/aws-sdk-go-v2/internal/configsources (go) v1.4.1
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 (go) v2.7.1
github.com/aws/aws-sdk-go-v2/internal/ini (go) v1.8.3
github.com/aws/aws-sdk-go-v2/service/ecr (go) v1.27.4
github.com/aws/aws-sdk-go-v2/service/ecrpublic (go) v1.23.4
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding (go) v1.13.0
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url (go) v1.13.1
github.com/aws/aws-sdk-go-v2/service/ssm (go) v1.52.4
github.com/aws/aws-sdk-go-v2/service/sso (go) v1.26.1
github.com/aws/aws-sdk-go-v2/service/ssooidc (go) v1.31.1
github.com/aws/aws-sdk-go-v2/service/sts (go) v1.35.1
github.com/aws/smithy-go (go) v1.22.5
github.com/awslabs/amazon-ecr-credential-helper/ecr-login (go) v0.0.0-20240419161514-af205d85bb44
github.com/aymanbagabas/go-osc52/v2 (go) v2.0.1
github.com/aymerick/douceur (go) v0.2.0
github.com/beorn7/perks (go) v1.0.1
github.com/cenkalti/backoff/v4 (go) v4.3.0
Files by Type (count)
Go
39
Markdown
13
Shell
11
Dockerfile
6
JSON
5
YAML
3
Other (.png)
3
Other (.svg)
2
Git Ignore
1
Other (no ext)
1
Makefile
1
Other (.mod)
1
Files by Type (size)
Other (.png)
1MB
Go
394KB
Other (.sum)
127KB
Markdown
69KB
Other (.svg)
25KB
Other (.mod)
18KB
Other (no ext)
11KB
Other (.golden)
9KB
Shell
8KB
YAML
4KB
Makefile
3KB
Dockerfile
2KB

The LLM identified 3 files worth highlighting for reuse:

Intercepts logrus output from Kaniko and redirects it to envbuilder's logging system. This is a non-obvious pattern that allows seamless integration of third-party library logging without modifying the library. It is isolated and could be extracted as a generic logrus hijacker for any Go application using logrus.

file: log/logrus.go ↗ | tags: #log-hijacking #logging-pattern

Temporarily remounts read-only filesystems (e.g., sysbox) to writable locations to prevent Kaniko from deleting them during image build. Handles complex edge cases like library symlinks and Debian multiarch. This demonstrates deep understanding of Linux mounts and container runtime quirks, and could be reused in other container build tools.

file: internal/ebutil/remount.go ↗ | tags: #filesystem #container-compatibility

Provides an in-memory Git server supporting HTTP and SSH protocols for testing Git clone operations without external dependencies. Implements enough of the Git protocol to simulate authentication, submodules, and refs. This is a novel test pattern that can be extracted and used in any project needing a fake Git server for integration tests.

file: testutil/gittest/gittest.go ↗ | tags: #test-utility #git-protocol
Last analyzed: 2026-09-25 23:41:04.298464
Next check: 2026-10-25 23:41:04.267216
$ submit: