I have a java project with a DockerFile that looks like that:
FROM openjdk:8-jdk-alpine
RUN addgroup -S spring && adduser -S spring -G spring
USER spring:spring
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} shape-shop-backend.jar
ENTRYPOINT ["java","-jar","/shape-shop-backend.jar"]
If I run docker like this :
C:\dev\shape-shop>docker build -t testtest:1.0
It builds an image perfectly.
I am under the assumption that "gcloud builds submit" works in the same way. I have a project on the google cloud called whataboutanewproject, so in the same directory I run this command :
C:\dev\shape-shop>gcloud builds submit --tag gcr.io/whataboutanewproject/shapeshop
But I get this error :
Digest: sha256:94792824df2df33402f201713f932b58cb9de94a0cd524164a0f2283343547b3
Status: Downloaded newer image for openjdk:8-jdk-alpine
---> a3562aa0b991
Step 2/6 : RUN addgroup -S spring && adduser -S spring -G spring
---> Running in 36cf2156a797
Removing intermediate container 36cf2156a797
---> 7320b32f6fe1
Step 3/6 : USER spring:spring
---> Running in f439aa9ca30e
Removing intermediate container f439aa9ca30e
---> 67f952c7bc2a
Step 4/6 : ARG JAR_FILE=target/*.jar
---> Running in 0bcfbf5f3b79
Removing intermediate container 0bcfbf5f3b79
---> 7519fa3bdc2f
Step 5/6 : COPY ${JAR_FILE} shape-shop-backend.jar
COPY failed: no source files were specified
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/docker" failed: step exited with non-zero status: 1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: (gcloud.builds.submit) build d3704337-88de-4dda-a120-ebd2a01ee8c9 completed with status "FAILURE"
C:\dev\shape-shop>
Why can it not process the DockerFile properly?
Does "gcloud build submit" even build an image? The documentation on the website is such utter garbage, that I have no clue actually what this "gcloud build submit" command even does.