I want to run a gradle build inside a container, then execute the jar with its config file and server parameters. This is what I have
WORKDIR /app
COPY . /app
RUN chmod +x gradlew \
&& gradle build
COPY config/*.yml build/libs
RUN cd build/libs \
&& ls -la
EXPOSE 8081
ENTRYPOINT ["java", "-jar", "/app/build/libs/app.jar", "-Dconfig.location=app/build/libs/config.yml", "-Dgrails.env=prod"]
I can see that both the yml file and the jar file are in the build libs folder, but when I build the dockerfile, I get error indicating missing yml file. When I reorder them and place config location before the jar file, it finds the config, but doesn't execute the jar file. When I purposely put an incorrect path to jar file, I get an error that jar is not found.
What I get after docker run is
Configuring Spring Security Core ...
... finished configuring Spring Security Core Configuring Spring Security REST 2.0.0.RC1...
... finished configuring Spring Security REST
And that's it. Although running locally I get "application running.." aswell. Any help appreciated!