Last active
July 4, 2021 07:12
-
-
Save sjednac/439fa37054c1cec326a10ddcd823fae0 to your computer and use it in GitHub Desktop.
Pushing Docker images to Amazon ECR using an SBT plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scalaVersion := "2.11.8" | |
| version := "0.1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enablePlugins(JavaAppPackaging) | |
| enablePlugins(DockerPlugin) | |
| packageName in Docker := "helloworld-ecr" | |
| version in Docker := version.value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.amazonaws.regions.{Region, Regions} | |
| region in ecr := Region.getRegion(Regions.US_EAST_1) | |
| repositoryName in ecr := (packageName in Docker).value | |
| localDockerImage in ecr := (packageName in Docker).value + ":" + (version in Docker).value | |
| push in ecr <<= (push in ecr) dependsOn (publishLocal in Docker) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sbt.version = 0.13.12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resolvers += Resolver.url("bintray-sbilinski", url("http://dl.bintray.com/sbilinski/maven"))(Resolver.ivyStylePatterns) | |
| addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.4") | |
| addSbtPlugin("com.mintbeans" % "sbt-ecr" % "0.2.0") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.4") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sbt ecr:createRepository \ | |
| ecr:login \ | |
| ecr:push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| docker run <aws-account-id>.dkr.ecr.<aws-region>.amazonaws.com/helloworld-ecr:latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| object SbtAmazonEcr extends App { | |
| while(true) { | |
| println("Hello Docker.") | |
| Thread.sleep(3000) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment