3

sbt-docker プラグインを使用してマルチモジュール プロジェクトをデプロイしようとしています。API モジュールとアプリ モジュール用に別のコンテナーを作成し、他のモジュールをスキップしたいと考えています。ただし、実行するたびにdocker: publish次のようなエラーが発生します。

[error] (api/*:publishConfiguration) Repository for publishing is not specified.
[error] (app/*:publishConfiguration) Repository for publishing is not specified.

これが私のbuild.sbtファイルです:

import sbt.Keys.publishTo

name := "project-name"

val globalSettings = Seq[SettingsDefinition](
  version := "1.0",
  scalaVersion := "2.12.4"
)

enablePlugins(DockerPlugin)

//.. other modules

val app = Project("app", file("app"))
  .enablePlugins(DockerPlugin)
  .dependsOn(repositories)
  .settings(globalSettings: _*)
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.akka" %% "akka-http" % "10.0.11",
      "com.typesafe.akka" %% "akka-http-testkit" % "10.0.11" % Test,
      "de.heikoseeberger" %% "akka-http-circe" % "1.18.0",
      "net.ruippeixotog" %% "scala-scraper" % "2.1.0"
    ),
    resolvers += Resolver.bintrayRepo("hseeberger", "maven")
  )
  .settings(assemblyJarName in assembly := "app.jar")
  .settings(dockerfile in docker := {
    val artifact: File = assembly.value
    val artifactTargetPath = s"/app/${artifact.name}"

    new Dockerfile {
      from("java")
      add(artifact, artifactTargetPath)
      entryPoint("java", "-jar", artifactTargetPath)
    }
  },
    imageNames in docker := Seq(ImageName(s"name/dru-app"))
  )

val api = Project("api", file("api"))
  .enablePlugins(DockerPlugin)
  .dependsOn(app)
  .settings(globalSettings: _*)
  .settings(
    libraryDependencies ++= Seq(
      "com.typesafe.akka" %% "akka-http" % "10.0.11",
      "com.typesafe.akka" %% "akka-http-testkit" % "10.0.11" % Test,
      "de.heikoseeberger" %% "akka-http-circe" % "1.18.0",
      "net.ruippeixotog" %% "scala-scraper" % "2.1.0"

    ),
    resolvers += Resolver.bintrayRepo("hseeberger", "maven")
  )
  .settings(assemblyJarName in assembly := "api.jar")
  .settings(dockerfile in docker := {
    val artifact: File = assembly.value
    val artifactTargetPath = s"/api/${artifact.name}"
    publishTo := Some(Resolver.file("Unused transient repository", file("https://hub.docker.com/r/name/dru-api")))

    new Dockerfile {
      from("java")
      add(artifact, artifactTargetPath)
      entryPoint("java", "-jar", artifactTargetPath)
    }
  },
    imageNames in docker := Seq(ImageName(s"name/dru-api"))
  )


val root = Project("DRU-W3-FP-1-Toloka-Parser", file("."))
  .aggregate(app, api)
  .settings(
    publish := {},
    publishLocal := {},
    publishArtifact := false,
    publishTo := Some(Resolver.file("Unused transient repository", file("target/unusedrepo")))
  )

build.sbt ファイルを修正して Docker ハブに公開する方法についてアドバイスをいただければ幸いです。

4

1 に答える 1