import * as ecr from "@distilled.cloud/aws/ecr"; import * as Effect from "effect/Effect"; import * as FileSystem from "effect/FileSystem"; import * as Path from "effect/Path"; import * as Redacted from "effect/Redacted"; import { Docker } from "../../Docker/Docker.ts"; import * as Provider from "../../Provider.ts"; import { Resource } from "../../Resource.ts"; import type { Providers } from "../Providers.ts"; /** * Docker login credentials for the account's private ECR registry, in the * shape `Docker.image.push` expects. The password is the decoded ECR bearer * token — a credential — so it is carried as `Redacted` and only unwrapped * inside `docker push`'s ephemeral auth config. */ export interface EcrRegistryCredentials { username: string; password: Redacted.Redacted; server: string; } /** * Resolves Docker login credentials for the account's private ECR registry * by decoding `ecr.getAuthorizationToken`. */ export declare const getEcrRegistryCredentials: Effect.Effect<{ username: string; password: Redacted.Redacted; server: string; }, ecr.GetAuthorizationTokenError, import("@distilled.cloud/aws/Credentials").Credentials | import("effect/unstable/http/HttpClient").HttpClient>; /** * Builds a Docker image from a local context and pushes it to the account's * private ECR registry. Shared by the `ECR.Image` provider and the * `ECS.Task` runtime resource (which materializes a generated Dockerfile * into its bundle context before delegating here). */ export declare const buildAndPushEcrImage: (docker: { readonly run: (args: Array) => Effect.Effect; readonly materialize: (options: { context: string; dockerfile: string; files: readonly { path: string; content: string | Uint8Array; }[]; }) => Effect.Effect; readonly container: { readonly create: (options: { name: string; image: string; volume: Array | undefined; env: Record | undefined; restart: "no" | "always" | "on-failure" | "unless-stopped"; rm: boolean; "health-cmd": string | undefined; "health-interval": string | undefined; "health-timeout": string | undefined; "health-retries": number | undefined; "health-start-period": string | undefined; "health-start-interval": string | undefined; "stop-timeout": string | undefined; p: Array | undefined; command: Array | undefined; label?: Record; context?: string; }) => Effect.Effect; readonly inspect: (name: string, context?: string) => Effect.Effect; readonly remove: (name: string, force?: boolean, context?: string) => Effect.Effect; readonly start: (name: string, context?: string) => Effect.Effect; readonly stop: (name: string, context?: string) => Effect.Effect; }; readonly image: { readonly build: (options: { context: string; tag: string; file?: string; platform?: string; target?: string; "build-arg"?: Record; "cache-from"?: Array; "cache-to"?: Array; args?: Array; engineContext?: string; }, session?: import("../../Cli/Cli.ts").ScopedPlanStatusSession) => Effect.Effect; readonly pull: (ref: string, platform?: string, context?: string) => Effect.Effect; readonly push: (ref: string, credentials: { server: string; username: string; password: string | Redacted.Redacted; }, platform?: string, context?: string) => Effect.Effect; readonly tag: (source: string, target: string, context?: string) => Effect.Effect; readonly inspect: (ref: string, context?: string) => Effect.Effect; readonly remove: (ref: string | Array, force?: boolean, context?: string) => Effect.Effect; }; readonly volume: { readonly create: (options: { name: string; driver?: string; opt?: Record; label?: Record; context?: string; }) => Effect.Effect; readonly remove: (name: string, context?: string) => Effect.Effect; readonly inspect: (name: string, context?: string) => Effect.Effect; }; readonly context: { readonly create: (options: { name: string; description?: string; docker?: string; }) => Effect.Effect; readonly update: (options: { name: string; description?: string; docker?: string; }) => Effect.Effect; readonly inspect: (name: string) => Effect.Effect; readonly remove: (name: string, force?: boolean) => Effect.Effect; }; readonly network: { readonly create: (options: { name: string; driver: string; ipv6?: boolean; label?: Record; context?: string; }) => Effect.Effect; readonly connect: (options: { network: string; container: string; alias?: string[]; context?: string; }) => Effect.Effect; readonly disconnect: (options: { network: string; container: string; context?: string; }) => Effect.Effect; readonly inspect: (name: string, context?: string) => Effect.Effect; readonly remove: (id: string, context?: string) => Effect.Effect; }; readonly swarm: { readonly init: (options: { context?: string; "advertise-addr"?: string; "listen-addr"?: string; "default-addr-pool"?: string[]; "default-addr-pool-mask-length"?: number; }) => Effect.Effect; readonly info: (context?: string) => Effect.Effect; readonly leave: (force?: boolean, context?: string) => Effect.Effect; }; readonly service: { readonly create: (options: { name: string; image: string; context?: string; replicas?: number; "endpoint-mode"?: "vip" | "dnsrr"; network?: string[]; constraint?: string[]; "replicas-max-per-node"?: number; "placement-pref"?: string[]; "update-parallelism"?: number; "update-delay"?: string; "update-monitor"?: string; "update-failure-action"?: "pause" | "continue" | "rollback"; "update-max-failure-ratio"?: number; "update-order"?: "stop-first" | "start-first"; "rollback-parallelism"?: number; "rollback-delay"?: string; "rollback-monitor"?: string; "rollback-failure-action"?: "pause" | "continue" | "rollback"; "rollback-max-failure-ratio"?: number; "rollback-order"?: "stop-first" | "start-first"; "restart-condition"?: "none" | "on-failure" | "any"; "restart-delay"?: string; "restart-max-attempts"?: number; "restart-window"?: string; "health-cmd"?: string; "health-interval"?: string; "health-timeout"?: string; "health-retries"?: number; "health-start-period"?: string; "stop-grace-period"?: string; mount?: string[]; secret?: string[]; config?: string[]; "read-only"?: boolean; publish?: string[]; label?: Record; env?: Record; command?: string[]; args?: string[]; }) => Effect.Effect; readonly update: (options: { id: string; image: string; context?: string; replicas?: number; "endpoint-mode"?: "vip" | "dnsrr"; "constraint-add"?: string[]; "constraint-rm"?: string[]; "replicas-max-per-node"?: number; "placement-pref"?: string[]; "update-parallelism"?: number; "update-delay"?: string; "update-monitor"?: string; "update-failure-action"?: "pause" | "continue" | "rollback"; "update-max-failure-ratio"?: number; "update-order"?: "stop-first" | "start-first"; "rollback-parallelism"?: number; "rollback-delay"?: string; "rollback-monitor"?: string; "rollback-failure-action"?: "pause" | "continue" | "rollback"; "rollback-max-failure-ratio"?: number; "rollback-order"?: "stop-first" | "start-first"; "restart-condition"?: "none" | "on-failure" | "any"; "restart-delay"?: string; "restart-max-attempts"?: number; "restart-window"?: string; "health-cmd"?: string; "health-interval"?: string; "health-timeout"?: string; "health-retries"?: number; "health-start-period"?: string; "stop-grace-period"?: string; "mount-add"?: string[]; "secret-add"?: string[]; "config-add"?: string[]; "read-only"?: boolean; "publish-add"?: string[]; "label-add"?: Record; "label-rm"?: string[]; "env-add"?: Record; args?: string; }) => Effect.Effect; readonly inspect: (id: string, context?: string) => Effect.Effect; readonly remove: (id: string, context?: string) => Effect.Effect; }; }, options: { /** Full image reference to build and push, e.g. `:`. */ imageUri: string; /** Docker build context directory. */ context: string; /** Absolute path to the Dockerfile. Defaults to `Dockerfile` in `context`. */ dockerfile?: string; /** Target platform, e.g. `"linux/amd64"`. */ platform?: string; /** Docker build arguments. */ buildArgs?: Record; }) => Effect.Effect; export interface ImageProps { /** * URI of the target ECR repository, e.g. `repository.repositoryUri` from an * `ECR.Repository`. When omitted, the Image auto-creates (and owns) a * repository whose name is derived from the logical id; the owned * repository is force-deleted when the Image is destroyed. */ repositoryUri?: string; /** * Docker build context directory. Every file under the context (plus the * Dockerfile, platform, and build args) participates in the content hash * that identifies the image — the image is rebuilt and pushed only when * that hash changes. */ context: string; /** * Path to the Dockerfile, relative to `context` unless absolute. * @default "Dockerfile" */ dockerfile?: string; /** * Target platform for the image build. Fargate defaults to X86_64, so the * default pins `linux/amd64` — without it an image built on an ARM64 host * (e.g. Apple Silicon) is rejected at task start. * @default "linux/amd64" */ platform?: string; /** * Docker build arguments (`--build-arg`). */ buildArgs?: Record; } export interface Image extends Resource<"AWS.ECR.Image", ImageProps, { /** Full image reference, `:`. */ imageUri: string; /** Registry manifest digest, e.g. `sha256:...`. */ digest: string; /** URI of the repository the image was pushed to. */ repositoryUri: string; /** Name of the repository the image was pushed to. */ repositoryName: string; /** Content-hash tag the image was pushed under. */ imageTag: string; /** Whether this Image auto-created (and owns) the backing repository. */ ownsRepository: boolean; }, never, Providers> { } /** * A Docker image built from a local context and pushed to a private Amazon * ECR repository. * * The image is identified by a content hash over the build context, * Dockerfile, platform, and build args. Reconcile rebuilds and pushes only * when that hash changes — a content change produces a new tag and digest on * the same resource, so replacement is never needed. * * ### Building Images * **Example:** Push to an ECR Repository * ```typescript * const repository = yield* AWS.ECR.Repository("AppRepository", {}); * const image = yield* AWS.ECR.Image("AppImage", { * repositoryUri: repository.repositoryUri, * context: "./app", * }); * ``` * * **Example:** Auto-created Repository * ```typescript * const image = yield* AWS.ECR.Image("AppImage", { * context: "./app", * }); * ``` * * ### Build Configuration * **Example:** Custom Dockerfile, Platform, and Build Args * ```typescript * const image = yield* AWS.ECR.Image("WorkerImage", { * repositoryUri: repository.repositoryUri, * context: "./worker", * dockerfile: "Dockerfile.worker", * platform: "linux/arm64", * buildArgs: { NODE_ENV: "production" }, * }); * ``` * * ### Consuming the Image * **Example:** Reference from a Task Definition * ```typescript * const task = yield* AWS.ECS.Task("ApiTask", { * main: import.meta.url, * sidecars: [{ name: "proxy", image: image.imageUri, essential: false }], * }); * ``` * * @resource */ export declare const Image: import("../../Resource.ts").ResourceClass; export declare const ImageProvider: () => import("effect/Layer").Layer, never, import("@distilled.cloud/aws/Credentials").Credentials | Docker | FileSystem.FileSystem | import("effect/unstable/http/HttpClient").HttpClient | Path.Path | import("../../Stack.ts").Stack | import("../../Stage.ts").Stage>; //# sourceMappingURL=Image.d.ts.map