jib icon indicating copy to clipboard operation
jib copied to clipboard

How can I execute a command before start my application?

Open Yingsheng-eroad opened this issue 6 years ago • 3 comments

My application is a sprint boot app. I use jib to build my docker image. I'd like to download a jar in the container and set the jar as the agent. I can set the jar via jvmFlags. How can I download the jar before starting the ever? Like that in my Dockerfile below.

FROM openjdk:8-jre-alpine

COPY app.jar app.jar

RUN curl -O https://website.com/java-agent/download/agent.zip
RUN unzip /tmp/agent.zip -d /opt && ls /opt/agent.jar

ENV JAVA_OPTS="-javaagent:/opt/agent.jar "

ENTRYPOINT exec java ${JAVA_OPTS} -jar app.jar

Yingsheng-eroad avatar Oct 23 '20 02:10 Yingsheng-eroad

Hello! If you want to download and unpack something, you could set up your Maven or Gradle build to do so. This example setup might help.

mpeddada1 avatar Oct 23 '20 14:10 mpeddada1

Hello! If you want to download and unpack something, you could set up your Maven or Gradle build to do so. This example setup might help.

Thanks.

Yingsheng-eroad avatar Oct 26 '20 20:10 Yingsheng-eroad

Closing this issue. Feel free to reopen it if you have any further questions!

mpeddada1 avatar Dec 07 '20 22:12 mpeddada1