Link Search Menu Expand Document

images

Description

The Provose images module creates AWS Elastic Container Registry (ECR) image repositories, optionally building containers from local directories to upload.

How to build and upload Docker images

If you have the docker command installed on the machine you use to run Provose, then Provose can build and upload your container when it creates the repository to upload your container. The Docker documentation describes how to install the docker command.

To upload new versions of your container manually, visit the Elastic Container Registry page in the AWS console. Select the repository that you created via Provose and click the button View push commands. This will give you commands specific to your AWS account to upload containers from a Windows, Mac, or Linux machine.

Examples

module "myproject" {
  source = "github.com/provose/provose?ref=v3.0.0"
  provose_config = {
    authentication = {
      aws = {
        region = "us-east-1"
      }
    }
    name                 = "myproject"
    internal_root_domain = "example-internal.com"
    internal_subdomain   = "production"
  }
  images = {
    "my_organization/my_container_1" = {
      # local_path is the location of the Dockerfile or the build context
      local_path = "../../src/my_container_1"
    }
    "my_organization/my_container_2" = {
      local_path = "../../src/my_container_2"
    }
    # It is also possible to not specify a local path, and instead create
    # an Amazon Web Services Elastic Container Registry (ECR) repository
    # to where you will push an image to later.
    # Note that if you have containers that depend on this ECR images, the
    # Application Load Balancer will throw HTTP 503 errors until you have
    # uploaded an image that can run.
    "my_organization/my_container_2" = {}
  }
}

Inputs

  • local_pathOptional. This is the filesystem path to pass to docker build. This builds, tags, and uploads a container to the registry. The path you pass should have a Dockerfile.

Outputs

  • image.aws_ecr_repository.image – map with a key for every repository name and every value is a Terraform aws_ecr_repository type.

  • image.aws_ecr_repository_policy.image – A map with a key for every repository name and every value is a Terraform aws_ecr_repository_policy type.