如何通过sbt-release在发布过程中推送/构建码头服务器映像 [英] How to push/build a docker image in release process via sbt-release

查看:128
本文介绍了如何通过sbt-release在发布过程中推送/构建码头服务器映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是scala的新手。

I'm a newbie for scala.

我使用了 sbt-release 来控制发布过程和 sbt-docker 来构建/发布码头图片

I used sbt-release to control release process and sbt-docker to build/publish a docker image.

我可以通过 sbt发行版发布特定版本,并通过 sbt docker 或`sbt dockerBuildAndPush'

I can release a specific version via sbt release and build/publish a docker image via sbt docker or `sbt dockerBuildAndPush'

如果我想发布一个特定的版本,我需要

If I wanna release a specific version, I need to


  1. 执行 sbt发布

  2. 记住发布版本修改Docker图像标签与发行版本

  3. 执行 sbt dockerBuildAndPush

  1. execute sbt release
  2. remember the release version and modify docker image tag with the release version
  3. execute sbt dockerBuildAndPush

但这太麻烦了...

我想添加构建/发布Docker映像到发布过程。

I wanna add build/publish docker image into release process.

例如:

我在 build.sbt中定义我的发布过程

val publishDocker = ReleaseStep(action = st => {
  // 1. get release version from sbt-release
  // 2. add release version to docker image tag
  // 3. push docker image to aws ecr
})

releaseProcess := Seq[ReleaseStep](
  checkSnapshotDependencies,            
  inquireVersions,                      
  runTest,                                
  setReleaseVersion,                     
  commitReleaseVersion,                   
  tagRelease,                            
  publishDocker,                      
  setNextVersion,                        
  commitNextVersion,                      
  pushChanges                            
)

但我不知道如何实现publishDocker函数。

But I have no idea how to implement publishDocker function.

感谢您的帮助〜

推荐答案

@ed感谢您的建议,我自己解决了:>

@ed Thanks for your advice and I solved it by myself :>

这是我的sbt: https://gist.github.com/pandaforme/7295694970de68568776f6a927709f07

我只是执行 sbt发布,它将自动编译,生成发布版本,构建和推送Docker映像等。

I just execute sbt release and it'll automatically compile, generate release version, build and push docker image, etc.

这篇关于如何通过sbt-release在发布过程中推送/构建码头服务器映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆