Skip to content

Add multi-platform Docker support for smoke-test-fake-backend #67

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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
11 changes: 10 additions & 1 deletion .github/workflows/pr-smoke-test-fake-backend-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ jobs:
- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Set up QEMU
uses: docker/setup-qemu-action@74864c85e1b5b09616e0e31b99c23db4e95b1011 # v3.2.0

- name: Set up JDK for running Gradle
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
Expand All @@ -29,9 +35,12 @@ jobs:
with:
cache-read-only: true

- name: Build Docker image
- name: Build Docker image (Jib - backward compatibility)
run: ./gradlew :smoke-tests:images:fake-backend:jibDockerBuild -Djib.httpTimeout=120000 -Djib.console=plain

- name: Build multi-platform Docker image
run: ./gradlew :smoke-tests:images:fake-backend:linuxBackendMultiPlatformImageBuild

buildWindows:
runs-on: windows-latest
defaults:
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/publish-smoke-test-fake-backend-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
- name: Free disk space
run: .github/scripts/gha-free-disk-space.sh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Set up QEMU
uses: docker/setup-qemu-action@74864c85e1b5b09616e0e31b99c23db4e95b1011 # v3.2.0

- name: Set up JDK for running Gradle
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
with:
Expand All @@ -43,9 +49,12 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1

- name: Build Docker image
- name: Build Docker image (Jib - backward compatibility)
run: ./gradlew :smoke-tests:images:fake-backend:jib -Djib.httpTimeout=120000 -Djib.console=plain -PextraTag=${{ env.TAG }}

- name: Build and push multi-platform Docker image
run: ./gradlew :smoke-tests:images:fake-backend:linuxBackendMultiPlatformImagePush -PextraTag=${{ env.TAG }}

publishWindows:
permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions build-scan.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://gradle.com/s/wkoqcfy2t2l3a
38 changes: 38 additions & 0 deletions smoke-tests/images/fake-backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,42 @@ tasks {
dependsOn(windowsBackendImageBuild)
images.add("ghcr.io/$repo/smoke-test-fake-backend-windows:$extraTag")
}

val linuxBackendImagePrepare by registering(Copy::class) {
dependsOn(shadowJar)
into(backendDockerBuildDir)
from("src/docker/backend")
from(shadowJar.get().outputs) {
rename { "fake-backend.jar" }
}
}

val linuxBackendMultiPlatformImageBuild by registering(Exec::class) {
dependsOn(linuxBackendImagePrepare)
group = "docker"
description = "Build multi-platform Linux Docker image for the test backend"
workingDir(backendDockerBuildDir)
commandLine(
"docker", "buildx", "build",
"--platform", "linux/amd64,linux/arm64",
"--tag", "ghcr.io/$repo/smoke-test-fake-backend:$extraTag",
"--file", "Dockerfile",
"."
)
}

val linuxBackendMultiPlatformImagePush by registering(Exec::class) {
dependsOn(linuxBackendImagePrepare)
group = "publishing"
description = "Build and push multi-platform Linux Docker image for the test backend"
workingDir(backendDockerBuildDir)
commandLine(
"docker", "buildx", "build",
"--platform", "linux/amd64,linux/arm64",
"--tag", "ghcr.io/$repo/smoke-test-fake-backend:$extraTag",
"--file", "Dockerfile",
"--push",
"."
)
}
}
3 changes: 3 additions & 0 deletions smoke-tests/images/fake-backend/src/docker/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM eclipse-temurin:11-jre
COPY fake-backend.jar /fake-backend.jar
CMD ["java", "-jar", "/fake-backend.jar"]