UNPKG

iop

Version:
44 lines 1.53 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.serviceNeedsBuilding = serviceNeedsBuilding; exports.getServiceImageName = getServiceImageName; exports.buildServiceImageName = buildServiceImageName; /** * Checks if a service needs to be built locally (vs using a pre-built image) */ function serviceNeedsBuilding(serviceEntry) { // If it has a build config, it needs building if (serviceEntry.build) { return true; } // If it doesn't have an image field, it needs building if (!serviceEntry.image) { return true; } // Services with image field but no build config are pre-built return false; } /** * Gets the base image name for a service */ function getServiceImageName(serviceEntry) { // If image is specified, use it as the base name if (serviceEntry.image) { return serviceEntry.image; } // Otherwise, generate a name based on the service name return `${serviceEntry.name}`; } /** * Builds the full image name for built services, or returns original name for pre-built services */ function buildServiceImageName(serviceEntry, releaseId) { const baseImageName = getServiceImageName(serviceEntry); // For services that need building, always use :latest if (serviceNeedsBuilding(serviceEntry)) { return `${baseImageName}:latest`; } // For pre-built services, use the image as-is (if it exists) return serviceEntry.image || baseImageName; } //# sourceMappingURL=image-utils.js.map