Hello,
I want to put my kotlin-spring-boot project into container:
FROM alpine:3.19.1
COPY ./ /tmp
EXPOSE 8080
RUN apk add openjdk17 && \
chmod +x ./tmp/gradlew && \
./tmp/gradlew build
ENTRYPOINT ./tmp/gradlew bootRun
,but during build:
$ docker build .
I get a failure on command ./tmp/gradlew build
Directory '/' does not contain a Gradle build.
By output in a console I see gradle has been downloaded successfully, so I don’t understand why docker doesn’t see it (and why does it point out on ‘/’ directory instead of ‘/tmp’?).
I tried to debug this by changing file in this way:
FROM alpine:3.19.1 as debug
COPY ./ /tmp
EXPOSE 8080
RUN apk add openjdk17
RUN chmod +x ./tmp/gradlew
FROM alpine:3.19.1 as next
RUN ./tmp/gradlew build
ENTRYPOINT ["echo", "hello world"]
and executing docker build -f Dockerfile --target debug --tag debug . (source)
It allowed me to run a shell docker run -it debug /bin/sh and execute all commands to check the image. I was able to run ./gradlew bootRun and deploy my application.
Could you help me please to figure out what is the issue with my initial image?