Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 396 forks source link

draft up fails with spring boot example - minikube 1.9 #588

Closed cmoulliard closed 6 years ago

cmoulliard commented 6 years ago

When we try to build the spring boot example packaged under the master branch of the draft project on minikube 1.9, then it fails

pwd             
/Users/dabou/Temp/to-be-deleted/draft/examples/example-spring-boot
draft up          
Draft Up Started: 'example-spring-boot'
example-spring-boot: Building Docker Image: FAIL ❌  (0.9963s)
example-spring-boot: Build ID: 01C93N2W30345AZJ6SWF1HAM9Y

As debug option doesn't really help and is not really verbose, how can we investigate why build is failing ?

cmoulliard commented 6 years ago

If I get the logs of the draftd pod, then I can figure out the error (= uberjar file not generated locally)

Step 1/9 : FROM maven:3.5-jdk-8 as BUILD
Step 1/9 : FROM maven:3.5-jdk-8 as BUILD
 ---> 76c9ab5df55b
Step 2/9 : COPY . /usr/src/app
 ---> 76c9ab5df55b
Step 2/9 : COPY . /usr/src/app
 ---> Using cache
 ---> cc09f2f77811
Step 3/9 : RUN mvn --batch-mode -f /usr/src/app/pom.xml clean package
 ---> Using cache
 ---> cc09f2f77811
Step 3/9 : RUN mvn --batch-mode -f /usr/src/app/pom.xml clean package
 ---> Using cache
 ---> 6431bd82c14b
Step 4/9 : FROM openjdk:8-jdk
 ---> Using cache
 ---> 6431bd82c14b
Step 4/9 : FROM openjdk:8-jdk
 ---> 891c9734d5ab
Step 5/9 : ENV PORT 4567
 ---> 891c9734d5ab
Step 5/9 : ENV PORT 4567
 ---> Using cache
 ---> 7b227b709677
Step 6/9 : EXPOSE 4567
 ---> Using cache
 ---> 7b227b709677
Step 6/9 : EXPOSE 4567
 ---> Using cache
 ---> 393911eb3cdf
 ---> Using cache
 ---> 393911eb3cdf
Step 7/9 : COPY --from=BUILD /usr/src/app/target/helloworld-jar-with-dependencies.jar /opt/app.jar
Step 7/9 : COPY --from=BUILD /usr/src/app/target/helloworld-jar-with-dependencies.jar /opt/app.jar
buildApp: buildImg error: lstat usr/src/app/target/helloworld-jar-with-dependencies.jar: no such file or directory
complete: wrote logs to /tmp/draft-logs676999161/01C93NGHNQXT03G2CH969312Q3
cmoulliard commented 6 years ago

How can we customise the dockerfile created by draft as it contains an error for the example-springboot and should be

FROM maven:3.5-jdk-8 as BUILD

COPY . /usr/src/app
RUN mvn --batch-mode -f /usr/src/app/pom.xml clean package

FROM openjdk:8-jdk
ENV PORT 4567
EXPOSE 4567
COPY --from=BUILD /usr/src/app/target/demo-0.0.1-SNAPSHOT.jar /opt/app.jar
WORKDIR /opt
CMD ["java", "-jar", "app.jar"]
bacongobbler commented 6 years ago

Hey @cmoulliard, after draft create has been called, you should see a Dockerfile present in your local directory. You can make the changes there and commit it to source control.

If you want to customize the default packs, you can create your own custom draft pack repository.

Will either of those solutions work for you?

bacongobbler commented 6 years ago

FYI #590 should also fix this up for you :)