import * as FileSystem from "effect/FileSystem"; import * as Path from "effect/Path"; import * as Provider from "../Provider.ts"; import { Resource } from "../Resource.ts"; import { Docker } from "./Docker.ts"; import type { Providers } from "./Providers.ts"; import { type ImageRegistry } from "./Registry.ts"; export interface DockerBuildOptions { /** * Build context directory. * * @default Current working directory. */ context?: string; /** * Dockerfile path, relative to the context unless absolute. * * @default "Dockerfile" */ dockerfile?: string; /** Target platform, e.g. `"linux/amd64"`. */ platform?: string; /** Docker build arguments. */ args?: Record; /** Multi-stage build target. */ target?: string; /** Cache sources passed as `--cache-from`. */ cacheFrom?: string[]; /** Cache destinations passed as `--cache-to`. */ cacheTo?: string[]; /** Additional Docker build options. */ options?: string[]; } export interface ImageProps { /** * Repository/name for the built image. * * @default Generated from stack, stage, logical id, and instance id. */ name?: string; /** Image tag. @default "latest" */ tag?: string; /** Registry credentials for push. */ registry?: ImageRegistry; /** Skip registry push even when `registry` is set. @default false */ skipPush?: boolean; /** Docker context name or context resource. */ context?: Docker.ContextRef; /** Docker build configuration. */ build: DockerBuildOptions; } export interface Image extends Resource<"Docker.Image", ImageProps, { /** Image repository/name without tag. */ name: string; /** Final image reference. Includes registry host when pushed there. */ imageRef: string; /** Local image id after build/tag. */ imageId: string; /** Registry digest after push when available. */ repoDigest?: string; /** Tag used for the local image. */ tag: string; /** Build timestamp in milliseconds since epoch. */ builtAt: number; }, never, Providers> { } /** * Builds, tags, and optionally pushes Docker images through the active Docker * context. * * This resource uses the Docker CLI and whatever daemon or remote context the * CLI is configured to target. It is separate from `Cloudflare.Container`; * registry image references are the boundary between Docker-managed images and * cloud container platforms. * * `Image` always builds from a Dockerfile. To pull (and optionally re-tag and * push) an existing registry image, use `Docker.RemoteImage`. * * * ### Building Images * **Example:** Build from a Dockerfile * ```typescript * const image = yield* Docker.Image("app", { * name: "my-app", * tag: "latest", * build: { * context: "./app", * dockerfile: "Dockerfile", * args: { NODE_ENV: "production" }, * }, * }); * ``` * * ### Registry Push * **Example:** Push with Redacted credentials * ```typescript * const image = yield* Docker.Image("app", { * name: "my-app", * build: { context: "./app" }, * registry: { * server: "ghcr.io", * username: "octocat", * password: Config.redacted("GITHUB_TOKEN"), * }, * }); * ``` * * ### Docker Context * **Example:** Build in a named Docker context * ```typescript * const image = yield* Docker.Image("app", { * name: "my-app", * context: "remote-build", * build: { context: "./app" }, * }); * ``` * * @resource */ export declare const Image: import("../Resource.ts").ResourceClass; export declare const ImageProvider: () => import("effect/Layer").Layer, never, Docker | FileSystem.FileSystem | Path.Path | import("../Stack.ts").Stack | import("../Stage.ts").Stage>; //# sourceMappingURL=Image.d.ts.map