Project Structure
When your project has multiple components, you can configure each one individually using Embfiles.
Multiple Components
Section titled “Multiple Components”Our fullstack app has two components:
emb components COMPONENT NAME ID CREATED STATUS-------------------------------------- web apiBoth were auto-discovered by the autodocker plugin. But where do their descriptions and tasks come from?
Component Embfiles
Section titled “Component Embfiles”Each component can have an Embfile.yml that adds component-specific configuration:
cat api/Embfile.ymldescription: REST API backend service
tasks: test: description: Run API tests script: npm test
lint: description: Run linter on API code script: npm run lint
fail: description: A task that will fail script: exit 1The embfiles plugin loads these files and merges them with the auto-discovered configuration.
The embfiles Plugin
Section titled “The embfiles Plugin”To enable Embfile loading, add the plugin to your .emb.yml:
plugins: - name: autodocker - name: embfiles # Load Embfile.yml from each componentThe order matters - autodocker discovers components first, then embfiles enriches them with additional configuration.
What Embfiles Can Define
Section titled “What Embfiles Can Define”Component Embfiles can include:
- description - Human-readable description
- resources - Additional or modified resources
- tasks - Component-specific tasks
- flavors - Component-level flavor patches
Viewing Merged Configuration
Section titled “Viewing Merged Configuration”To see how everything comes together:
emb config print | head -30components: web: resources: image: type: docker/image params: {} description: Web frontend served by nginx tasks: test: description: Run frontend tests script: echo 'Running frontend tests...' && exit 0 rootDir: web api: resources: image: type: docker/image params: {} description: REST API backend service tasks: test: description: Run API tests script: npm test lint: description: Run linter on API code script: npm run lint fail: description: A task that will fail script: exit 1 rootDir: apidefaults: {}Next Step
Section titled “Next Step”Continue to Environment Variables to learn about the dotenv plugin and variable expansion.