Skip to main content

AwsEcrImageTagModule

AwsEcrImageTagModule is an ECR-based AWS module that publishes one version of a container image.

It builds the image from a Dockerfile and pushes it into the repositories of the image it points at - terraform has no resource that puts an image into a registry, so octo drives the build and the push itself.

A repository holds many versions, so it is pointed at by many of these modules, one per version. Adding a module publishes a version alongside the ones already there; removing a module deletes that version and leaves the rest untouched. A published version is never edited: a tag is immutable, so republishing one deletes it first.

@cost

ECR storage of the version pushed, about $0.10 per GB-month; the build itself runs on the machine running octo.

@downtime

None of its own: an execution moves to a new version as its own downtime says. Building and pushing the image lengthens the apply by however long Docker takes.

@example

TypeScript

import { type Image, stub } from '@quadnix/octo';
import { AwsEcrImageTagModule } from '@quadnix/octo-aws-cdk/modules/image/aws-ecr-image-tag';

octo.loadModule(AwsEcrImageTagModule, 'my-image-tag-module', {
architecture: 'arm64',
buildArguments: { NODE_ENV: 'production' },
buildSecrets: { NPM_TOKEN: 'NPM_TOKEN' },
dockerfileDirectory: 'images/nginx',
dockerfileName: 'Dockerfile',
image: stub<Image>('${{my-image-module.model.image}}'),
imageTag: '0.0.1'
});
@group

Modules/Image/AwsEcrImageTag

@limit

The machine running octo needs Docker, and the image is built for one architecture; the execution running it must run that processor.

@limit

buildSecrets reach the build as Docker secrets and stay out of the image's layers; buildArguments are written into the image's history.

@losesData

Deleting the module deletes that version from every repository, which octo can only build again while dockerfileDirectory still holds its code.

@replaces

Changing what the image is built from publishes the tag again: the old version is deleted first, since a tag is immutable.

@see

Hierarchy

Index

Constructors

constructor

  • Parameters

    • moduleId: string

      The ID this module is loaded under.

    Returns AwsEcrImageTagModule

Properties

readonlyinheritedmoduleId

moduleId: string

The ID this module was loaded under. It scopes everything the module produces, so the same module class can be loaded more than once.

staticreadonlyinheritedMODULE_PACKAGE

MODULE_PACKAGE: string

The package the module is registered under, set by Module.

staticreadonlyinheritedMODULE_SCHEMA

MODULE_SCHEMA: any

The schema of the module's inputs, set by Module.

Methods

onInit

  • Creates the overlay holding this version, joined to the image whose repositories it is published into.


    Parameters

    Returns Promise<AwsEcrImageTagOverlay>

inheritedregisterHooks

  • registerHooks(): { postCommitHooks?: PostHookSignature[]; postModelActionHooks?: PostHookSignature[]; postResourceActionHooks?: PostHookSignature[]; preCommitHooks?: PreHookSignature[]; preModelActionHooks?: PreHookSignature[]; preResourceActionHooks?: PreHookSignature[] }
  • To hook custom behavior into Octo's lifecycle for the duration of this module. Override it to return the callbacks you want run.

    @see

    Techniques for Hooks.


    Returns { postCommitHooks?: PostHookSignature[]; postModelActionHooks?: PostHookSignature[]; postResourceActionHooks?: PostHookSignature[]; preCommitHooks?: PreHookSignature[]; preModelActionHooks?: PreHookSignature[]; preResourceActionHooks?: PreHookSignature[] }

    • optionalpostCommitHooks?: PostHookSignature[]
    • optionalpostModelActionHooks?: PostHookSignature[]
    • optionalpostResourceActionHooks?: PostHookSignature[]
    • optionalpreCommitHooks?: PreHookSignature[]
    • optionalpreModelActionHooks?: PreHookSignature[]
    • optionalpreResourceActionHooks?: PreHookSignature[]

inheritedregisterMetadata

  • To derive values that both AModule.onInit and this module's actions need - typically facts resolved from another module's anchors, such as an account ID or a region's availability zones. Override it, and the returned object is handed to every action of this module as actionInputs.metadata.


    Parameters

    Returns Promise<Record<string, unknown>>