Skip to content

Commit

Permalink
Fix docker compose (#889)
Browse files Browse the repository at this point in the history
  • Loading branch information
etspaceman authored Aug 16, 2024
1 parent 7cfe296 commit c964185
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions project/DockerComposePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object DockerComposePlugin extends AutoPlugin {
.task {
val log = sbt.Keys.streams.value.log
val cmd =
s"docker-compose -f ${composeFile.value} up -d "
s"docker compose -f ${composeFile.value} up -d "
log.info(s"Running $cmd")
val res = Process(
cmd,
Expand All @@ -46,7 +46,7 @@ object DockerComposePlugin extends AutoPlugin {
"COMPOSE_PROJECT_NAME" -> composeProjectName.value
).!
if (res != 0)
throw new IllegalStateException(s"docker-compose up returned $res")
throw new IllegalStateException(s"docker compose up returned $res")
}
.dependsOn(createNetworkTask)

Expand All @@ -60,7 +60,7 @@ object DockerComposePlugin extends AutoPlugin {

val dockerComposeKillTask: Def.Initialize[Task[Unit]] = Def.task {
val log = sbt.Keys.streams.value.log
val cmd = s"docker-compose -f ${composeFile.value} kill -s 9"
val cmd = s"docker compose -f ${composeFile.value} kill -s 9"
log.info(s"Running $cmd")
val res = Process(
cmd,
Expand All @@ -70,12 +70,12 @@ object DockerComposePlugin extends AutoPlugin {
"COMPOSE_PROJECT_NAME" -> composeProjectName.value
).!
if (res != 0)
throw new IllegalStateException(s"docker-compose kill returned $res")
throw new IllegalStateException(s"docker compose kill returned $res")
}

val dockerComposeDownBaseTask: Def.Initialize[Task[Unit]] = Def.task {
val log = sbt.Keys.streams.value.log
val cmd = s"docker-compose -f ${composeFile.value} down -v"
val cmd = s"docker compose -f ${composeFile.value} down -v"
log.info(s"Running $cmd")
val res = Process(
cmd,
Expand All @@ -85,7 +85,7 @@ object DockerComposePlugin extends AutoPlugin {
"COMPOSE_PROJECT_NAME" -> composeProjectName.value
).!
if (res != 0)
throw new IllegalStateException(s"docker-compose down returned $res")
throw new IllegalStateException(s"docker compose down returned $res")
}

val dockerComposeDownTask: Def.Initialize[Task[Unit]] =
Expand All @@ -101,7 +101,7 @@ object DockerComposePlugin extends AutoPlugin {
val dockerComposeLogsTask: Def.Initialize[Task[Unit]] = Def.task {
val log = sbt.Keys.streams.value.log
val cmd =
s"docker-compose -f ${composeFile.value} logs"
s"docker compose -f ${composeFile.value} logs"
log.info(s"Running $cmd")
val res = Process(
cmd,
Expand All @@ -111,13 +111,13 @@ object DockerComposePlugin extends AutoPlugin {
"COMPOSE_PROJECT_NAME" -> composeProjectName.value
).!
if (res != 0)
throw new IllegalStateException(s"docker-compose logs returned $res")
throw new IllegalStateException(s"docker compose logs returned $res")
}

val dockerComposePsTask: Def.Initialize[Task[Unit]] = Def.task {
val log = sbt.Keys.streams.value.log
val cmd =
s"docker-compose -f ${composeFile.value} ps -a"
s"docker compose -f ${composeFile.value} ps -a"
log.info(s"Running $cmd")
val res = Process(
cmd,
Expand All @@ -127,7 +127,7 @@ object DockerComposePlugin extends AutoPlugin {
"COMPOSE_PROJECT_NAME" -> composeProjectName.value
).!
if (res != 0)
throw new IllegalStateException(s"docker-compose ps -a returned $res")
throw new IllegalStateException(s"docker compose ps -a returned $res")
}

def settings(
Expand Down Expand Up @@ -155,12 +155,12 @@ object DockerComposePlugin extends AutoPlugin {

object DockerComposePluginKeys {
val composeFileLocation =
settingKey[String]("Path to docker-compose files, e.g. docker/")
settingKey[String]("Path to docker compose files, e.g. docker/")
val composeFileName =
settingKey[String]("File name of the compose file, e.g. docker-compose.yml")
val networkName = settingKey[String]("Name of network to create")
val composeProjectName =
settingKey[String]("Name of project for docker-compose.")
settingKey[String]("Name of project for docker compose.")
val buildImage = settingKey[Boolean](
"Determines if dockerComposeUp should also build a docker image via the DockerImagePlugin"
)
Expand All @@ -171,16 +171,16 @@ object DockerComposePluginKeys {
taskKey[Unit]("Brings up docker, runs 'test', brings down docker")
val dockerComposeUp =
taskKey[Unit](
"Builds the images and then runs `docker-compose -f <file> up -d` for the scope"
"Builds the images and then runs `docker compose -f <file> up -d` for the scope"
)
val dockerComposeDown =
taskKey[Unit]("Runs `docker-compose -f <file> down` for the scope")
taskKey[Unit]("Runs `docker compose -f <file> down` for the scope")
val dockerComposeRestart =
taskKey[Unit](
"Runs `docker-compose -f <file> down` and `docker-compose -f <file> up` for the scope"
"Runs `docker compose -f <file> down` and `docker compose -f <file> up` for the scope"
)
val dockerComposeLogs =
taskKey[Unit]("Runs `docker-compose -f <file> logs` for the scope")
taskKey[Unit]("Runs `docker compose -f <file> logs` for the scope")
val dockerComposePs =
taskKey[Unit]("Runs `docker-compose -f <file> ps -a` for the scope")
taskKey[Unit]("Runs `docker compose -f <file> ps -a` for the scope")
}

0 comments on commit c964185

Please sign in to comment.