librecaptcha / lc-core

The LibreCaptcha framework, for self-hosted, privacy respecting CAPTCHAs
Apache License 2.0
397 stars 21 forks source link

Dockerfile build failing "/build" No such file or directory #246

Open dmestudent opened 1 month ago

dmestudent commented 1 month ago

Hello,

I am trying to build the dockerfile you provide in this repository but I receive the following error in the "builder" step.

#16 [builder 2/3] RUN ls -la
#16 0.342 total 4
#16 0.342 drwxr-xr-x 1 root root    6 Aug 14 07:15 .
#16 0.342 drwxr-xr-x 1 root root    0 Aug 14 07:26 ..
#16 0.342 -rw-r--r-- 1 root root 1298 Aug 14 07:14 build.sbt
#16 0.342 drwxr-xr-x 1 root root   28 Aug 14 07:14 lib
#16 0.342 drwxr-xr-x 1 root root   58 Aug 14 07:14 project
#16 0.342 drwxr-xr-x 1 root root    8 Aug 14 07:14 src
#16 0.342 drwxr-xr-x 1 root root  102 Aug 14 07:15 target
#16 DONE 1.0s

#17 [builder 3/3] RUN sbt assembly
#17 1.607 [info] welcome to sbt 1.7.1 (Eclipse Adoptium Java 17.0.12)
#17 2.255 [info] loading settings for project build-build from plugins.sbt ...
#17 2.805 [info] loading project definition from /build/project
#17 3.897 [info] loading settings for project root from build.sbt ...
#17 4.352 [info] set current project to LibreCaptcha (in build file:/build/)
#17 4.937 [info] compiling 14 Scala sources and 9 Java sources to /build/target/scala-3.4.2/classes ...
#17 4.974 [warn] javac exited with exit code -1
#17 4.977 [error] ## Exception when compiling 23 sources to /build/target/scala-3.4.2/classes
#17 4.977 [error] java.io.IOException: Cannot run program "javac" (in directory "/build"): error=2, No such file or directory

I added the ls -la Step for debugging purposes

Any tips are highly appreciated.

Thanks in advance

hrj commented 1 month ago

It's been a while, so I need time to recollect.

Meanwhile, Can you post the full docker command line that you tried?

And can you try with docker-compose? (Note you need to uncomment build as per the comments in the docker compose file)

dmestudent commented 1 month ago

Hello,

the command line I am trying is the following. Be aware that I had to remove some information for privacy purposes.

docker build --build-arg HTTP_PROXY=<redacted> --build-arg HTTPS_PROXY=<redacted> -f Dockerfile -t <redacted>/libre-captcha:dev .

Trying with docker compose is not possible since I am building on a dedicated jenkins server in my CI/CD pipeline.

Best regards and thank you for your time

hrj commented 1 month ago

I currently don't have a docker setup where I can test this out, but can you try changing the first line of the Dockerfile from eclipse-temurin:17-jre-jammy to eclipse-temurin:17-jdk-jammy. I suspect that the JRE version has dropped javac from the image, and hence the javac error.

hrj commented 1 month ago

Or, as you suggested, the problem could be that the /build directory doesn't exist. The directory either needs to be mounted as a volume or created inside the docker image. Hence, either,

  1. add -v /myBuildDirectory:/build on the command line where /myBuildDirectory is the path of an actual directory on the host
  2. or add a RUN mkdir /build inside the Dockerfile