Hello, I am having trouble building my application...
# gradle
c
Hello, I am having trouble building my application that is based on the kotlin multiplattform full stack example. I got it to work on the windows machine where I use my IDE, but I also need to build on a linux machine as a docker image, which doesn't seem to work. Both machines are behind the same corporate proxy, which I think is the source of the problem. I fed the proxy credentials to gradle.properties, .npmrc, .yarnrc, docker service and also to the environments of the docker containers that are running gradle build. What am I missing? Thanks in advance!
Copy code
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> A problem occurred starting process 'command '/home/gradle/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node''
gradle build --stacktrace:
Copy code
Caused by: java.io.IOException: Cannot run program "/home/gradle/.gradle/nodejs/node-v18.12.1-linux-x64/bin/node" (in directory "/usr/app/build/js"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
        ... 7 more
This is my current Dockerfile, note that it may be a bit messy because I am experimenting with this and that:
Copy code
# temp container to build using gradle
FROM gradle:8.1.1-jdk17-alpine AS TEMP_BUILD_IMAGE
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME

# Load environment variables from a file
COPY proxy.env $APP_HOME
ENV ENV_FILE_PATH=$APP_HOME/proxy.env
RUN source $ENV_FILE_PATH

COPY build.gradle.kts settings.gradle.kts .npmrc .yarnrc gradle.properties.local gradle.properties $APP_HOME
RUN cat gradle.properties.local >> gradle.properties

COPY gradle $APP_HOME/gradle

RUN gradle build --stacktrace || return 0

COPY . .
RUN cat gradle.properties.local >> gradle.properties
RUN gradle clean build

# actual container
FROM amazoncorretto:17.0.7-alpine
ENV ARTIFACT_NAME=app-jvm-1.0-SNAPSHOT.jar
ENV APP_HOME=/usr/app/

WORKDIR $APP_HOME

COPY --from=TEMP_BUILD_IMAGE $APP_HOME/build/libs/$ARTIFACT_NAME .

EXPOSE 8080
ENTRYPOINT exec java -jar ${ARTIFACT_NAME}
1
e
Alpine is the problem. The node binary needs glibc.
c
@ephemient Thank you very much for pointing that out. Switching to an other image worked.