Add Docker Compose Support for Multi-Container Applications #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
As someone who's been deploying increasingly complex applications, I found myself wishing Sidekick could handle my docker-compose setups as elegantly as it handles single Dockerfiles. This PR brings that capability to life, addressing issue #74.
I've implemented comprehensive Docker Compose support while staying true to Sidekick's core philosophy: simplicity without sacrificing power. The implementation seamlessly detects compose files and guides users through deployment with the same straightforward experience they've come to expect.
What I've added:
Intelligent Detection: Automatically recognizes
docker-compose
files and offers a choice when both a Dockerfile and compose file exist.Multi-Service Builds: Efficiently builds only services with build contexts, preserving pre-built images.
User-Driven Selection: Rather than making assumptions, asks users to identify which service should receive web traffic.
Seamless Integration: Automatically-configures Traefik labels and networks while preserving your compose structure.
Environment Flexibility: Handles both array and map formats for environment variables.
Zero-Downtime Updates: Deploy new versions without interrupting running services.
Technical Approach
I've designed this to feel native to Sidekick - no new commands or complex configurations. Just run
sidekick launch
and follow the prompts. The code respects existing patterns while extending capabilities for multi-container architectures.Backwards Compatibility
Existing Dockerfile deployments continue to work exactly as before. This is purely additive functionality.
I've been using this for my own projects that need compose (Next.js apps with Postgres/Redis, Node services with multiple workers, etc.) and it's been working well enough that I figured others might want it too.
Example Flow
Hope this helps folks who've been wanting compose support. Happy to make any changes based on feedback.
TODO
Future Enhancements
Multi-app support with different ports per domain
Currently, Sidekick assumes one main web service per deployment.
Docker Compose files often define multiple services exposing different ports (API, admin panel, websockets, etc.).
Future versions really should support multiple web services with different domains/subdomains (while maintaining the hassle-free auto-deploy philosophy).
Example:
api.example.com:3000
,app.example.com:3001
,admin.example.com:3002
.This would require updating Traefik label generation to support multiple routers per deployment.
Named volume management
Better handling of named volumes across deployments.
Volume backup/restore functionality.