Project Structure of docker-to-iac Module
The project follows standard npm module organization with additional structure to handle both Docker run commands and Docker Compose files.
Directory Structure
bash
docker-to-iac/
|-- .github/
|-- dist/
|-- src/
| |-- index.ts
| |-- config/
| | |-- render/
| | | |-- service-types.ts
| |-- parsers/
| | |-- aws-cloudformation.ts
| | |-- base-parser.ts
| | |-- digitalocean.ts
| | |-- render.ts
| |-- sources/
| | |-- base.ts
| | |-- factory.ts
| | |-- compose/
| | | |-- index.ts
| | | |-- validate.ts
| | |-- run/
| | | |-- index.ts
| |-- types/
| | |-- container-config.ts
| |-- utils/
| |-- constructImageString.ts
| |-- digitalOceanParserServiceName.ts
| |-- getImageUrl.ts
| |-- parseCommand.ts
| |-- parseDockerImage.ts
| |-- parseEnvironmentVariables.ts
| |-- parsePort.ts
|-- test/
| |-- docker-compose-files/
| |-- docker-run-files/
| |-- output/
| |-- test.ts
|-- .gitignore
|-- eslint.config.mjs
|-- LICENSE
|-- README.md
|-- package-lock.json
|-- package.json
|-- release.config.cjs
|-- tsconfig.json
Directory Purposes
Core Directories
src/
- Source codetest/
- Test files and test casesdist/
- Compiled output.github/
- GitHub workflows and templates
Source Code Organization
Config (src/config/
)
Contains provider-specific configurations:
render/
- Render.com specific configurationsservice-types.ts
- Service type mappings for Render.com deployments (web, private services, Redis)
Each cloud provider can have its own subdirectory for configuration files that affect how the parser handles specific cases for that provider.
Parsers (src/parsers/
)
Contains IaC-specific parsers for different cloud providers:
base-parser.ts
- Base parser classaws-cloudformation.ts
- AWS CloudFormation parserdigitalocean.ts
- DigitalOcean App Platform parserrender.ts
- Render Blueprint parser
Source Handlers (src/sources/
)
Handles different input types:
compose/
- Docker Compose file processingrun/
- Docker run command processingbase.ts
- Base source handlerfactory.ts
- Source handler factory
Types (src/types/
)
TypeScript type definitions:
container-config.ts
- Container configuration types
Utilities (src/utils/
)
Helper functions for parsing and processing:
- Docker image handling
- Command parsing
- Environment variable processing
- Port mapping utilities
- and many more...
Adding New Source
Add new input source handlers in src/sources/
:
bash
src/sources/new-source/
|-- index.ts
|-- validate.ts # if needed
Testing
Place test files in appropriate directories:
- Docker Compose files:
test/docker-compose-files/
- Docker run commands:
test/docker-run-files/
- Test output:
test/output/