我正在运行命令 docker buildx build --push --platform linux/amd64,linux/arm64 -t steinko/gradle-ci-cd 。o/gradle-ci-cd 。命令挂了
[+] Building 2108.8s (20/23)
=> CACHED [linux/amd64 gradleimage 1/5] FROM docker.io/library/gradle@sha256:9b0871b0061cae621a5f9ca67359da36810e5aeae3a917f4c78ae3cbed6313a5 0.0s
=> => resolve docker.io/library/gradle@sha256:9b0871b0061cae621a5f9ca67359da36810e5aeae3a917f4c78ae3cbed6313a5 0.0s
=> [internal] load build context 0.4s
=> => transferring context: 17.15MB 0.4s
=> CACHED [linux/amd64 stage-1 1/3] FROM docker.io/library/openjdk@sha256:fa5414c6c4f8f836308947ae46daf65f2bce39ac01e89edfbe730cd0703dca06 0.0s
=> => resolve docker.io/library/openjdk@sha256:fa5414c6c4f8f836308947ae46daf65f2bce39ac01e89edfbe730cd0703dca06 0.0s
=> [linux/arm64 gradleimage 2/5] COPY ./app /home/gradle/source/app 0.1s
=> [linux/amd64 gradleimage 2/5] COPY ./app /home/gradle/source/app 0.1s
=> [linux/arm64 gradleimage 3/5] COPY settings.gradle /home/gradle/source/settings.gradle 0.0s
=> [linux/amd64 gradleimage 3/5] COPY settings.gradle /home/gradle/source/settings.gradle 0.0s
=> [linux/amd64 gradleimage 4/5] WORKDIR /home/gradle/source 0.0s
=> [linux/arm64 gradleimage 4/5] WORKDIR /home/gradle/source 0.0s
=> [linux/amd64 gradleimage 5/5] RUN gradle build 2106.6s
=> => # > Task :app:jar SKIPPED
=> => # > Task :app:assemble
=> => # > Task :app:compileTestJava
=> => # > Task :app:processTestResources NO-SOURCE
=> => # > Task :app:testClasses
=> => # > Task :app:test
=> [linux/arm64 gradleimage 5/5] RUN gradle build 34.4s
=> [linux/arm64 stage-1 2/3] COPY --from=gradleimage /h
我的 Docker 文件看起来像这样
FROM gradle as gradleimage
COPY ./app /home/gradle/source/app
COPY settings.gradle /home/gradle/source/settings.gradle
WORKDIR /home/gradle/source
RUN gradle build
FROM openjdk
COPY --from=gradleimage /home/gradle/source/app/build/libs/app.jar /app/
WORKDIR /app
ENTRYPOINT ["java", "-jar", "app.jar"]
我的 Gradle 文件看起来像这样
plugins {
id 'org.springframework.boot' version '2.4.5'
id 'java'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web:2.4.5'
testImplementation('org.springframework.boot:spring-boot-starter-test:2.4.5')
testImplementation 'io.rest-assured:spring-mock-mvc:4.3.0'
testImplementation 'io.rest-assured:rest-assured-common:4.3.1'
}
test {
useJUnitPlatform()
}
我该如何解决悬挂问题?