gothinkster / spring-boot-realworld-example-app

Example Spring codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.
MIT License
1.31k stars 680 forks source link

Docker build failed #29

Closed eugenesimakin closed 3 years ago

eugenesimakin commented 3 years ago

Hi folks,

I was trying to build the project with docker to push the image to a docker repo but the build failed:

Sending build context to Docker daemon  981.5kB
Step 1/12 : FROM gradle:jdk-alpine
 ---> 8017d8c2ba74
Step 2/12 : WORKDIR /home/gradle/project
 ---> Using cache
 ---> d3b9d5f4da94
Step 3/12 : EXPOSE 8080
 ---> Using cache
 ---> 64b5d259408a
Step 4/12 : USER root
 ---> Using cache
 ---> 4b54f6919a92
Step 5/12 : RUN apk update
 ---> Using cache
 ---> aff74c308198
Step 6/12 : ENV GRADLE_USER_HOME /home/gradle/project
 ---> Using cache
 ---> 961419bda82f
Step 7/12 : COPY . /home/gradle/project
 ---> 20280f86bff9
Step 8/12 : RUN gradle build
 ---> Running in f89f3fc54e02

Welcome to Gradle 5.4.1!

Here are the highlights of this release:
 - Run builds with JDK12
 - New API for Incremental Tasks
 - Updates to native projects, including Swift 5 support

For more details see https://docs.gradle.org/5.4.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* Where:
Build file '/home/gradle/project/build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.4.RELEASE']
> Failed to apply plugin [id 'org.springframework.boot']
   > Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 5.4.1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 15s

Environment: OS: Ubuntu 20.04 Docker version: 20.10.1, build 831ebea

eugenesimakin commented 3 years ago

I found the cause of the issue and fixed it in PR. This happens because gradle wrapper is not used in building process.