@nasriya/orchestriq
Version:
A package to generate Docker files
92 lines (91 loc) • 4.3 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const DockerSocket_1 = __importDefault(require("./socket/DockerSocket"));
const ContainersManager_1 = __importDefault(require("./containers/ContainersManager"));
const NetworksManager_1 = __importDefault(require("./networks/NetworksManager"));
const VolumesManager_1 = __importDefault(require("./volumes/VolumesManager"));
const ImagesManager_1 = __importDefault(require("./images/ImagesManager"));
const DockerfileTemplate_1 = __importDefault(require("./containers/templates/assets/builders/Dockerfile/DockerfileTemplate"));
const DockerfileBuilder_1 = __importDefault(require("./containers/templates/assets/builders/Dockerfile/DockerfileBuilder"));
class Docker {
#_socket = new DockerSocket_1.default();
#_containers = new ContainersManager_1.default(this.#_socket);
#_networks = new NetworksManager_1.default(this.#_socket);
#_volumes = new VolumesManager_1.default(this.#_socket);
#_images = new ImagesManager_1.default(this.#_socket);
constructor(configs) {
this.#_socket.update(configs);
}
/**
* Retrieves the containers manager associated with the Docker instance.
* @returns {ContainersManager} An instance of the ContainersManager class, providing APIs to manage containers within the Docker daemon.
*/
get containers() { return this.#_containers; }
/**
* Retrieves the networks manager associated with the Docker instance.
* @returns {NetworksManager} An instance of the NetworksManager class, providing APIs to manage networks within the Docker daemon.
*/
get networks() { return this.#_networks; }
/**
* Retrieves the volumes manager associated with the Docker instance.
* @returns {VolumesManager} An instance of the VolumesManager class, providing APIs to manage volumes within the Docker daemon.
*/
get volumes() { return this.#_volumes; }
/**
* Retrieves the images manager associated with the Docker instance.
* @returns {ImagesManager} An instance of the ImagesManager class, providing APIs to manage images within the Docker daemon.
*/
get images() { return this.#_images; }
/**
* Retrieves the templates available for generating.
* @since v1.0.3
*/
builders = Object.freeze({
/**
* Retrieves a Dockerfile builder, allowing you to generate a Dockerfile used to build a Docker image.
* @returns {DockerfileBuilder} A Dockerfile builder that can be used to generate a Dockerfile.
* @since v1.0.3
*/
dockerfile: () => {
return new DockerfileBuilder_1.default();
},
/**
* Retrieves a Dockerfile template builder with default settings.
*
* This method provides an easy way to create a Dockerfile template
* without complex configuration. It is suitable for users who
* want to quickly generate a Dockerfile using standard settings.
*
* For advanced users, we recommend using the `dockerfile` method
* to create a custom Dockerfile template.
*
* @returns {DockerfileTemplate} A Dockerfile template builder that can be used to generate a Dockerfile.
* @since v1.0.3
*/
easyDockerfileTemplate: () => {
return new DockerfileTemplate_1.default();
}
});
/**
* Retrieves the templates available for generating.
* @returns {Object} An object containing the available templates.
*/
templates = Object.freeze({
/**
* Retrieves a Dockerfile template builder, allowing you to generate a Dockerfile used to build a Docker image.
* @returns {DockerfileTemplate} A Dockerfile template builder that can be used to generate a Dockerfile.
* @deprecated
* Use `builders.easyDockerfileTemplate` instead, or use
* `builders.dockerfile` for advanced users.
*
* Deprecated since v1.0.3.
*/
dockerfile: () => {
return new DockerfileTemplate_1.default();
}
});
}
exports.default = Docker;