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

Use 'buildx' to build multiarch JIT image #7

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
with:
java-version: 17
distribution: 'temurin'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker login
uses: docker/login-action@v2
with:
Expand All @@ -32,4 +36,4 @@ jobs:
TESTCONTAINERS_RYUK_DISABLED: true
run: |
export DOCKER_IMAGE=`echo "${DOCKER_REGISTRY_URL}/${DOCKER_REPOSITORY_PATH}/btcproxyd-jit" | sed -e 's#//#/#' -e 's#^/##'`
./gradlew check dockerPush --no-daemon -s --info --scan
./gradlew check dockerBuildxImage --no-daemon -s --info --scan
18 changes: 16 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ test {
environment(['MICRONAUT_CONFIG_FILES':''])
}

// TODO: See if we can use this HOW-TO to build AMD64 & ARM64: https://dev.to/cloudx/multi-arch-docker-images-the-easy-way-with-github-actions-4k54
// See also: https://github.com/bmuschko/gradle-docker-plugin/issues/967#issuecomment-1103768609

tasks.named("dockerfile") {
baseImage = "eclipse-temurin:17-jre-jammy"
}
Expand All @@ -109,7 +112,18 @@ dockerBuildNative {
images = ["${System.env.DOCKER_IMAGE ?: project.name}:$project.version"]
}

def registry = 'consensusj'
def jitImageName = "$project.name-jit"

// Build and Push btcproxyd-jit for ARM64 and AMD64 architectures
task dockerBuildxImage(type:Exec) {
group 'build'
description "Builds multiplatform image using 'docker buildx'"
dependsOn dockerfile, buildLayers
workingDir 'build/docker/main'
executable 'docker'
args = ['buildx', 'build', '--platform', 'linux/amd64,linux/arm64', '-t', "$registry/$jitImageName:$project.version", '-t', "$registry/$jitImageName:latest", '--push', '.']
}

apply from: 'gradle/asciidoctor.gradle'
apply from: 'gradle/github-pages.gradle'


2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
btcProxyVersion = 0.3.15
btcProxyVersion = 0.3.17

useMavenLocal = false

Expand Down