java:openjdk-8-jdk-alpine doesn't work for automated build
Closed this issue · 8 comments
When I try to change the _Dockerfile and use java:openjdk-8-jdk-alpine instead of java:8, the build failed:
Here the stacktrace:
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/4.4.7/node-4.4.7-linux-x64.tar.gz into /code/node/tmp
[INFO] Copying node binary from /code/node/tmp/node-v4.4.7-linux-x64/bin/node to /code/node/node
[INFO] Installed node locally.
[INFO] Installing npm version 3.10.5
[INFO] Downloading http://registry.npmjs.org/npm/-/npm-3.10.5.tgz to /root/.m2/repository/com/github/eirslett/npm/3.10.5/npm-3.10.5.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/npm/3.10.5/npm-3.10.5.tar.gz into /code/node/node_modules
[INFO] Installed npm locally.
[INFO]
[INFO] --- frontend-maven-plugin:1.0:npm (npm install) @ jhipster-sample-application ---
[INFO] Running 'npm install' in /code
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 50.174 s
[INFO] Finished at: 2016-09-11T21:45:24+00:00
[INFO] Final Memory: 47M/471M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (npm install) on project jhipster-sample-application: Failed to run task: 'npm install' failed. java.io.IOException: Cannot run program "/code/node/node" (in directory "/code"): error=2, No such file or directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The command '/bin/sh -c echo '{ "allow_root": true }' > /root/.bowerrc && cd /code/ && ./mvnw clean package -Pprod -DskipTests && mv /code/target/*.war /app.war && rm -Rf /code && rm -Rf /root/.m2/wrapper && rm -Rf /root/.m2/repository && rm -Rf /root/.gradle && rm -Rf /home/jhipster/.npm/' returned a non-zero code: 1
The command "docker build -t jhipster-sample-app ." exited with 1.
Already reported here too: jhipster/jhipster-registry#58 (comment)
I'm stuck with this! Maybe @PierreBesson you have an idea ?
I tried a lot of thing, but didn't manage to resolve it. I'm pretty sure it comes from alpine, something different between jessie image and alpine image...
Of course it doesn't work because alpine doesn't play well with node. I had the same issue in the past and pretty much gave up hope to build the front-end in an alpine environment.
Also we should migrate to the openjdk image as it seems "Java" is now deprecated https://hub.docker.com/_/java/
Did Oracle try to pressure docker ???
Oh I didn't see this before, it's very recent: so I had to change my base image.
We have to change this, on the main generator too
Currently, the image size is approximatively: ~358 MB
It can be optimized by using alpine, but I'm fine with the current image.
Closing this, as it can be improved later...
Reading this https://docs.docker.com/engine/userguide/eng-image/multistage-build/
I'm pretty sure we can use openjdk:8-jre-alpine
now!
Multi stage build are now available in docker starting from v17.05.
I just did a test (PierreBesson/jhipster-registry@a9272c2) and got the registry docker image from 735MB to 145MB !
Now we just have to wait for multistage to be supported by the docker hub.
Yes I'm waiting this @PierreBesson !
https://docs.docker.com/engine/installation/#time-based-release-schedule
@PierreBesson : I already tried it too :p
- here my code: jhipster/jhipster-registry@master...pascalgrimaud:docker-multi-stage-builds
- here the Travis log: https://travis-ci.org/pascalgrimaud/jhipster-registry/builds/238473352
REPOSITORY TAG IMAGE ID CREATED SIZE
jhipster/jhipster-registry travis 0fc254bf9000 Less than a second ago 145MB
<none> <none> 9cf45903d86e 4 seconds ago 678MB
openjdk 8-jre-alpine 58ce9579eac6 3 hours ago 81.4MB
openjdk 8 ab0ecda9094c 2 weeks ago 610MB
Fix in this commit: 1584e33