4.2 KiB
Marketplace Repository - Copilot Instructions
Project Overview
This repository maintains Docker Compose templates for deploying open-source applications. The core structure revolves around the compose-files/ directory, where each subdirectory represents a deployable service (e.g., compose-files/nginx/ for Nginx web server).
Key components:
- Compose Files: Self-contained templates with
docker-compose.yml(service definitions). - meta.json: Centralized index of all templates. Entries include
id,name,version,description,logo,links, andtags. - Scripts: Node.js tools in root and
build-scripts/for maintainingmeta.json(deduplication, sorting, validation).
Data flow: New templates added to compose-files/ → Metadata updated in meta.json → Processing scripts ensure consistency → Templates ready for deployment.
The "why": Enables rapid, standardized deployment of 300+ OSS apps without manual config. Structure prioritizes simplicity—each template is independent, no shared state or complex interdependencies.
Key Files and Directories
meta.json: Array of template objects. Always process after edits usingnode dedupe-and-sort-meta.jsto remove duplicates (byid) and sort alphabetically.compose-files/<service>/:docker-compose.yml: Standard Docker Compose v3.8. May include ports, volumes, and environment variables as needed.logo.svg/png: Service icon, referenced inmeta.json.
dedupe-and-sort-meta.js: Standalone script—readsmeta.json, removes duplicateids (keeps first), sorts byid(case-insensitive), creates timestamped backup.build-scripts/process-meta.js: Advanced processor with CLI options (--verbose,--no-backup,--input/--output), JSON schema validation (required:id,name,version,description,links.github,logo,tagsarray).
Exemplary template: compose-files/nginx/—docker-compose.yml defines Nginx service; meta entry tags as ["proxy", "web-server"].
Development Workflow
-
Add/Update Template:
- Create
compose-files/<id>/(e.g.,nginx). - Implement
docker-compose.yml(single or multiple services; use volumes for persistence). - Add/update
meta.jsonentry with exactidmatching folder. - Run
node dedupe-and-sort-meta.js --backupto validate/sort. - Commit and push changes.
- Create
-
Local Development:
- Meta processing:
node build-scripts/process-meta.js --verboseornode dedupe-and-sort-meta.js --backup. - Test template: Use
docker-compose upin the service directory to test locally.
- Meta processing:
-
CI/CD:
.github/workflows/validate-meta.yml: Runs validation on push/PR—fails on duplicates, invalid JSON, missing fields.- Integrate processing: Add
node build-scripts/process-meta.jsto build steps; use--no-backupin CI.
No tests in repo—focus on manual validation via scripts and Docker Compose testing. Debug: Check console output from processing scripts for warnings (e.g., missing id).
Conventions and Patterns
- Template IDs: Lowercase, kebab-case (e.g.,
active-pieces); unique across repo—enforced by dedupe script. - Docker Compose: Standard Docker Compose v3.8 format. Include
restart: unless-stopped, persistent volumes (e.g.,- db-data:/var/lib/postgresql/data). Services typically named after folder (e.g.,nginxservice). - Meta.json: Entries as JSON objects; tags array of lowercase strings (e.g., ["monitoring", "database"]); links object with
github,website,docs. - Versions: Use
latesttag or pin to specific versions indocker-compose.yml(e.g.,nginx:1.25-alpine); match inmeta.json.version. - Logos: SVG preferred; size ~128x128; file name in
meta.json.logo(e.g., "nginx.svg").
Cross-component: No runtime communication—templates independent. Each template can be deployed standalone using Docker Compose.
Integration Points
- Docker Compose: Templates can be deployed directly using
docker-compose up. Test deploys validate env interpolation and service configuration. - External Deps: Docker Compose (v3.8+). No runtime deps beyond Node.js for meta processing scripts.
When editing, always re-run meta processing and validate template deployment.