Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Gradle build docker image tasks #408

Merged
merged 10 commits into from
Oct 19, 2023
5 changes: 4 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/

plugins { id("com.hedera.fullstack.root") }
plugins {
id("com.hedera.fullstack.root")
id("com.bmuschko.docker-remote-api").version("9.3.4")
}

repositories {
// mavenLocal() // uncomment to use local maven repository
Expand Down
37 changes: 37 additions & 0 deletions docker/kubectl-bats/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
jeromy-cannon marked this conversation as resolved.
Show resolved Hide resolved
id("com.palantir.docker").version("0.35.0")
}

var repo = "ghcr.io"
var registry = "hashgraph/full-stack-testing"
var containerName = "kubectl-bats"
var appVersion = project.version.toString()

docker {
name = "${repo}/${registry}/${containerName}:${appVersion}"
version = "${appVersion}"
buildx(true)
var isCi = System.getenv("CI")
if (isCi != null && !isCi.isEmpty()) {
platform('linux/arm64', 'linux/amd64')
push(true)
} else {
load(true) // loads the image into the local docker daemon, doesn't support multi-platform
}
}
37 changes: 37 additions & 0 deletions docker/ubi8-init-dind/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id("com.palantir.docker").version("0.35.0")
}

var repo = "ghcr.io"
var registry = "hashgraph/full-stack-testing"
var containerName = "ubi8-init-dind"
var appVersion = project.version.toString()

docker {
name = "${repo}/${registry}/${containerName}:${appVersion}"
version = "${appVersion}"
buildx(true)
var isCi = System.getenv("CI")
if (isCi != null && !isCi.isEmpty()) {
platform('linux/arm64', 'linux/amd64')
push(true)
} else {
load(true) // loads the image into the local docker daemon, doesn't support multi-platform
}
}
38 changes: 38 additions & 0 deletions docker/ubi8-init-java17/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2023 Hedera Hashgraph, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

plugins {
id("com.palantir.docker").version("0.35.0")
}

var repo = "ghcr.io"
var registry = "hashgraph/full-stack-testing"
var containerName = "ubi8-init-java17"
var appVersion = project.version.toString()

docker {
name = "${repo}/${registry}/${containerName}:${appVersion}"
version = "${appVersion}"
files('entrypoint.sh', 'network-node.service')
buildx(true)
var isCi = System.getenv("CI")
if (isCi != null && !isCi.isEmpty()) {
platform('linux/arm64', 'linux/amd64')
push(true)
} else {
load(true) // loads the image into the local docker daemon, doesn't support multi-platform
}
}
23 changes: 13 additions & 10 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,26 @@
* limitations under the License.
*/

pluginManagement {
includeBuild("build-logic")
// includeBuild("fullstack-gradle-plugin")
}
pluginManagement { includeBuild("build-logic") }

plugins {
id("com.gradle.enterprise").version("3.14.1")
id("com.hedera.fullstack.settings")
// id("com.hedera.fullstack.fullstack-gradle-plugin")
}

dependencyResolutionManagement {
// includeBuild("fullstack-gradle-plugin")
}

rootProject.name = "full-stack-testing"

includeBuild(".") // https://github.com/gradlex-org/java-module-dependencies/issues/26

// Include the subprojects
include(":docker-kubectl-bats", "docker/kubectl-bats")

include(":docker-ubi8-init-dind", "docker/ubi8-init-dind")

include(":docker-ubi8-init-java17", "docker/ubi8-init-java17")

include(":fullstack-bom")

// Include the subprojects
include(":fullstack-alerting-api")

include(":fullstack-alerting-core")
Expand Down Expand Up @@ -95,3 +93,8 @@ gradleEnterprise {
}
}
}

fun include(name: String, path: String) {
include(name)
project(name).projectDir = File(rootDir, path)
}