103 lines
2.5 KiB
TypeScript
103 lines
2.5 KiB
TypeScript
/**
|
|
* Configuration interface for tsdocker
|
|
* Extends legacy config with new Docker build capabilities
|
|
*/
|
|
export interface ITsDockerConfig {
|
|
// Legacy (backward compatible)
|
|
baseImage: string;
|
|
command: string;
|
|
dockerSock: boolean;
|
|
keyValueObject: { [key: string]: any };
|
|
|
|
// New Docker build config
|
|
registries?: string[];
|
|
registryRepoMap?: { [registry: string]: string };
|
|
buildArgEnvMap?: { [dockerArg: string]: string };
|
|
platforms?: string[]; // ['linux/amd64', 'linux/arm64']
|
|
push?: boolean;
|
|
testDir?: string;
|
|
}
|
|
|
|
/**
|
|
* Options for constructing a DockerRegistry
|
|
*/
|
|
export interface IDockerRegistryOptions {
|
|
registryUrl: string;
|
|
username: string;
|
|
password: string;
|
|
}
|
|
|
|
/**
|
|
* Information about a discovered Dockerfile
|
|
*/
|
|
export interface IDockerfileInfo {
|
|
filePath: string;
|
|
fileName: string;
|
|
version: string;
|
|
baseImage: string;
|
|
buildTag: string;
|
|
localBaseImageDependent: boolean;
|
|
}
|
|
|
|
/**
|
|
* Options for creating a Dockerfile instance
|
|
*/
|
|
export interface IDockerfileOptions {
|
|
filePath?: string;
|
|
fileContents?: string;
|
|
read?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Result from a Docker build operation
|
|
*/
|
|
export interface IBuildResult {
|
|
success: boolean;
|
|
tag: string;
|
|
duration?: number;
|
|
error?: string;
|
|
}
|
|
|
|
/**
|
|
* Result from a Docker push operation
|
|
*/
|
|
export interface IPushResult {
|
|
success: boolean;
|
|
registry: string;
|
|
tag: string;
|
|
digest?: string;
|
|
error?: string;
|
|
}
|
|
|
|
/**
|
|
* Options for the build command
|
|
*/
|
|
export interface IBuildCommandOptions {
|
|
patterns?: string[]; // Dockerfile name patterns (e.g., ['Dockerfile_base', 'Dockerfile_*'])
|
|
platform?: string; // Single platform override (e.g., 'linux/arm64')
|
|
timeout?: number; // Build timeout in seconds
|
|
noCache?: boolean; // Force rebuild without Docker layer cache (--no-cache)
|
|
cached?: boolean; // Skip builds when Dockerfile content hasn't changed
|
|
verbose?: boolean; // Stream raw docker build output (default: silent)
|
|
context?: string; // Explicit Docker context name (--context flag)
|
|
}
|
|
|
|
export interface ICacheEntry {
|
|
contentHash: string; // SHA-256 hex of Dockerfile content
|
|
imageId: string; // Docker image ID (sha256:...)
|
|
buildTag: string;
|
|
timestamp: number; // Unix ms
|
|
}
|
|
|
|
export interface ICacheData {
|
|
version: 1;
|
|
entries: { [cleanTag: string]: ICacheEntry };
|
|
}
|
|
|
|
export interface IDockerContextInfo {
|
|
name: string; // 'default', 'rootless', 'colima', etc.
|
|
endpoint: string; // 'unix:///var/run/docker.sock'
|
|
isRootless: boolean;
|
|
dockerHost?: string; // value of DOCKER_HOST env var, if set
|
|
}
|