{"id":16547439,"url":"https://github.com/sjednac/sbt-ecr","last_synced_at":"2025-10-07T09:54:47.104Z","repository":{"id":49167765,"uuid":"68243782","full_name":"sjednac/sbt-ecr","owner":"sjednac","description":"An SBT plugin for managing Docker images within Amazon ECR.","archived":false,"fork":false,"pushed_at":"2022-03-31T18:37:07.000Z","size":94,"stargazers_count":52,"open_issues_count":11,"forks_count":26,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-12T05:53:54.250Z","etag":null,"topics":["amazon-ecr","aws","aws-ecr","docker","sbt","sbt-plugin"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sjednac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-14T21:12:05.000Z","updated_at":"2024-10-25T10:45:03.000Z","dependencies_parsed_at":"2022-09-05T20:51:21.384Z","dependency_job_id":null,"html_url":"https://github.com/sjednac/sbt-ecr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sjednac/sbt-ecr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjednac%2Fsbt-ecr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjednac%2Fsbt-ecr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjednac%2Fsbt-ecr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjednac%2Fsbt-ecr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sjednac","download_url":"https://codeload.github.com/sjednac/sbt-ecr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sjednac%2Fsbt-ecr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278755164,"owners_count":26040034,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-ecr","aws","aws-ecr","docker","sbt","sbt-plugin"],"created_at":"2024-10-11T19:14:25.885Z","updated_at":"2025-10-07T09:54:47.089Z","avatar_url":"https://github.com/sjednac.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sbt-ecr\n\nAn [SBT](http://www.scala-sbt.org/) plugin for managing [Docker](http://docker.io) images within [Amazon ECR](https://aws.amazon.com/ecr/).\n\n[ ![Download](https://api.bintray.com/packages/sbilinski/sbt-plugins/sbt-ecr/images/download.svg) ](https://bintray.com/sbilinski/sbt-plugins/sbt-ecr/_latestVersion)\n\n## Features\n\n* Create ECR repositories using `ecr:createRepository`\n* Login to the remote registry using `ecr:login`\n* Push local images using `ecr:push`\n\n## Installation\n\nAdd the following to your `project/plugins.sbt` file:\n\n    addSbtPlugin(\"com.mintbeans\" % \"sbt-ecr\" % \"0.16.0\")\n\nAdd ECR settings to your `build.sbt`. The following snippet assumes a Docker image build using [sbt-native-packager](https://github.com/sbt/sbt-native-packager):\n\n    import com.amazonaws.regions.{Region, Regions}\n    \n    enablePlugins(EcrPlugin)\n\n    region           in Ecr := Region.getRegion(Regions.US_EAST_1)\n    repositoryName   in Ecr := (packageName in Docker).value\n    localDockerImage in Ecr := (packageName in Docker).value + \":\" + (version in Docker).value\n\n    // Create the repository before authentication takes place (optional)\n    login in Ecr := ((login in Ecr) dependsOn (createRepository in Ecr)).value\n\n    // Authenticate and publish a local Docker image before pushing to ECR\n    push in Ecr := ((push in Ecr) dependsOn (publishLocal in Docker, login in Ecr)).value\n    \nKeep in mind that `ecr:createRepository` is a completely optional step. If you have a [managed infrastructure](https://en.wikipedia.org/wiki/Infrastructure_as_code) (e.g. create everything, including the repository, using [AWS CloudFormation](https://aws.amazon.com/cloudformation/), [Terraform](https://www.terraform.io/) or some other tool), then it might be better to skip this step, and assume that the repository exist, when you trigger the process.\n\nThat being said, it's a convenient feature, when you don't rely on any tool like this. We support several policy-related settings, that will allow you to fine-tune the repository, if needed (read ahead).\n\n## Usage\n\nThe plugin [follows](https://github.com/sbilinski/sbt-ecr/blob/master/src/main/scala/sbtecr/Aws.scala) common security\nconventions. That is, you can use the following **authentication** methods:\n\n* provide `AWS_ACCESS_KEY_ID` and `AWS_SECRET_KEY` as [environment variables](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/EnvironmentVariableCredentialsProvider.html).\n* provide `aws.accessKeyId` and `aws.secretKey` as [system properties](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/SystemPropertiesCredentialsProvider.html).\n* use a [profile](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/profile/ProfileCredentialsProvider.html) specified by the `AWS_DEFAULT_PROFILE` environment variable.\n* use the [EC2 instance profile](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/EC2ContainerCredentialsProviderWrapper.html) when the process is run directly in [Amazon EC2](https://aws.amazon.com/ec2/).\n\nTo make it work **locally**, you may configure an AWS profile according to the [reference page](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html), and spawn the `push` process as such:\n\n    AWS_DEFAULT_PROFILE=\u003cyour_profile_name\u003e sbt ecr:push\n\n## Tagging\n\nBy default, the produced image will be tagged as \"latest\". It is possible to provide arbitrary additional tags,\n for example to add the version tag to the image:\n    \n    repositoryTags in Ecr ++= Seq(version.value)\n    \nIf you don't want latest tag on your image you could override the ```repositoryTags``` value completely:\n \n    repositoryTags in Ecr := Seq(version.value)\n\nIf you want to make the tag environment-dependent you can use the following template:\n\n    repositoryTags in Ecr := sys.env.get(\"VERSION_TAG\").map(Seq(_)).getOrElse(Seq(\"latest\"))\n\nAnd trigger the process using:\n\n    VERSION_TAG=myfeature sbt ecr:push\n\n## Tag immutability\n\nBy default, when the `createRepository` task is executed, the new repository will have **Tag immutability**\ndisabled. You can control this behavior using the following setting:\n\n    imageTagsMutable in Ecr := false\n \n## Cross account publishing\n\nBy default, when the `login` task is executed, authentication will target the **registry id** and **repository domain** of the AWS account belonging to the role used.\n\nIf you need cross account authentication, you can override registry domain and target any registry id.\n\nExample usage:\n\n    repositoryDomain in Ecr := Some(\"myecr.example.com\")\n    registryIds in Ecr ++= Seq(\"your AWS account id\")\n\n## Repository security policy configuration\n\nBy default, when the `createRepository` task is executed, the new repository does not have a **security policy**\nattached. \n\nWhen you set `repositoryPolicyText` in your `build.sbt` file, and the `createRepository` is called, the created\nrepository will have the configured policy. \n\nExample usage:\n    \n    repositoryPolicyText in Ecr := Some(IO.read(file(\"project\") / \"ecrpolicy.json\")) \n    \nThen in the `project/ecrpolicy.json` you can set your policy text. For example:\n    \n    {\n      \"Version\": \"2012-10-17\",\n      \"Statement\": [\n        {\n          \"Sid\": \"BuildServerAccess\",\n          \"Effect\": \"Allow\",\n          \"Principal\": {\n            \"AWS\": [\n              \"arn:aws:iam::YOUR_ACCOUNT_ID_HERE:role/YOUR_IAM_ROLE_NAME_HERE\"\n            ]\n          },\n          \"Action\": [\n            \"ecr:*\"\n          ]\n        }\n      ]\n    }\n \nConfiguring `repositoryPolicyText` will not affect existing repositories.\n\n## Repository lifecycle policy configuration\n\nConfiguring the repository lifecycle policy works the same as configuring the policy in the previous chapter.\n\nBy default, when the `createRepository` task is executed, the new repository does not have a **lifecycle \npolicy** attached. \n\nWhen you set `repositoryLifecyclePolicyText` in your `build.sbt` file, and the `createRepository` is called, the created\nrepository will have the configured lifecycle policy. \n\nExample usage:\n    \n    repositoryLifecyclePolicyText in Ecr := Some(IO.read(file(\"project\") / \"ecrlifecyclepolicy.json\")) \n    \nThen in the `project/ecrlifecyclepolicy.json` you can set your policy text. For example:\n    \n    {\n      \"rules\": [\n        {\n          \"rulePriority\": 10,\n          \"description\": \"Lifecycle of release branch images\",\n          \"selection\": {\n            \"tagStatus\": \"tagged\",\n            \"tagPrefixList\": [\n              \"release\"\n            ],\n            \"countType\": \"imageCountMoreThan\",\n            \"countNumber\": 20\n          },\n          \"action\": {\n            \"type\": \"expire\"\n          }\n        }\n      ]\n    }\n \nConfiguring `repositoryLifecyclePolicyText` will not affect existing repositories.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjednac%2Fsbt-ecr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsjednac%2Fsbt-ecr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsjednac%2Fsbt-ecr/lists"}