@deploystack/docker-to-iac
Version:
Translate docker run and docker compose file to Infrastructure as Code
18 lines (17 loc) • 841 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateDockerCompose = validateDockerCompose;
const base_1 = require("../base");
function validateDockerCompose(dockerCompose) {
// Validation: Check if services exist
if (!dockerCompose.services || Object.keys(dockerCompose.services).length === 0) {
throw new base_1.SourceValidationError('No services found in docker-compose file');
}
// Validation: Check if each service has an image
for (const [serviceName, service] of Object.entries(dockerCompose.services)) {
if (!service.image) {
throw new base_1.SourceValidationError(`Service '${serviceName}' does not have an image specified. ` +
'All services must use pre-built images. Build instructions are not supported.');
}
}
}