#13953: feat(docker): add .env template and improve Dockerfile
docker
Cluster:
Docker and Deployment Improvements
## Summary
Improves Docker deployment experience with a documented .env template and Dockerfile hardening.
### Changes
#### docker-compose.env.example (NEW)
- Complete .env template with all Docker Compose variables
- Documented defaults and explanations for each variable
- Covers: gateway config, data dirs, image selection, browser sidecar, AI provider keys
#### Dockerfile improvements
- **Security**: Replace `curl | bash` Bun installer with pinned version downloaded from GitHub releases (addresses #9479)
- **Orchestration**: Add `HEALTHCHECK` instruction so container runtimes can monitor gateway health
- Pin Bun to v1.2.4 via `BUN_VERSION` build arg for reproducible builds
### Motivation
Lowers the barrier to Docker deployment. New users can copy the .env template and get started without reading source code.
Related to #6900 (Docker support improvements).
### Testing
- `docker compose config` validates with the .env template
- Dockerfile builds successfully on amd64
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds a comprehensive `.env` template (`docker-compose.env.example`) documenting all Docker Compose configuration variables and hardens the Dockerfile by replacing the insecure `curl | bash` Bun installer with a pinned release download. Also adds a `HEALTHCHECK` instruction for container orchestration monitoring.
**Key improvements:**
- **Security**: Replaces `curl | bash` pattern with explicit Bun v1.2.4 download from GitHub releases (addresses security concern #9479)
- **Usability**: New `.env` template provides clear documentation for gateway config, data directories, image selection, browser sidecar, and AI provider keys
- **Reliability**: Pinned Bun version via `BUN_VERSION` build arg ensures reproducible builds
- **Observability**: `HEALTHCHECK` allows container runtimes to monitor gateway health
**Note**: The browser sidecar env vars in `docker-compose.env.example` are documented but not referenced in `docker-compose.yml` - these appear to be passed to browser containers spawned by the gateway at runtime rather than docker-compose services.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are well-scoped improvements to Docker deployment: removing a security anti-pattern (curl pipe to bash), adding useful documentation, and improving container health monitoring. The Bun installation is now deterministic and verifiable. The .env template is purely documentation. One minor suggestion about healthcheck port configurability doesn't affect functionality.
- No files require special attention
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#7133: feat: Automated Docker setup with environment-based configuration
by synetalsolutions · 2026-02-02
84.4%
#8050: fix: docker hardening
by christopherbarnett96 · 2026-02-03
82.2%
#9992: Docker: Fixed port mapping so ports publish when not stated
by Lightmean03 · 2026-02-06
81.8%
#10174: fix(docker): exclude .env files from Docker build context
by coygeek · 2026-02-06
81.6%
#7342: fix(docker): ensure readability of docker-setup.sh
by esc-ouni · 2026-02-02
81.3%
#9190: feat(docker): Add autonomous container self-restart and runtime pac...
by alexdredmon · 2026-02-05
80.8%
#13950: fix(docker): add browser sidecar service and health checks
by n24q02m · 2026-02-11
80.0%
#9999: Docker: fix token mismatch and add dev setup workflow
by benclarkeio · 2026-02-06
79.1%
#11818: fix(docker): resolve build hang by using in-place ownership and opt...
by dilly · 2026-02-08
78.4%
#11478: Chore: add Dockerfile HEALTHCHECK and debug-log silent catch blocks
by U-C4N · 2026-02-07
77.8%